针对另一个域远程使用 Get-DnsServerResourceRecord

Nic*_*ley 3 powershell powershell-remoting

我正在尝试运行以下命令

$secpasswd = 'Test'
$secpasswd = ConvertTo-SecureString $secpasswd -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ('domain2\nick', $secpasswd)

[scriptblock]$CheckDNS = {
Get-DnsServerResourceRecord -Name 'computername' -ZoneName domain2.local -ComputerName domain2dC.domain2.local }

invoke-command -scriptblock $CheckDNS -Credential $mycreds -ComputerName domain2managementbox.domain2.local 
Run Code Online (Sandbox Code Playgroud)

这应该在目标计算机上运行 Get-DnsServerResourceRecord 模块,但是我收到以下错误:

Failed to get the zone information for domain2.local on server domain2managementbox.domain2.local.
+ CategoryInfo          : PermissionDenied: (dgtest.local:root/Microsoft/...rResourceRecord) [Get-DnsServerResourceRecord], CimException
+ FullyQualifiedErrorId : WIN32 5,Get-DnsServerResourceRecord
Run Code Online (Sandbox Code Playgroud)

当我在盒子本身上运行命令时,它工作正常并且我拥有正确的权限。

谢谢

Rob*_*bin 5

您正在尝试使用您的凭据“双跳”(从客户端计算机到“domain2managementbox.domain2.local”,然后再次到“domain2dC.domain2.local”。使用默认的 kerberos 身份验证不允许这样做。

\n\n

Enable-WSManCredSSP -Role Client -DelegateComputer domain2managementbox.domain2.local -Force在您的客户端计算机上运行。

\n\n

Enable-WSMaCredSSP -Role Server \xe2\x80\x93Force在“domain2managementbox.domain2.local”上运行

\n\n

...然后用作 的-CredSSP附加身份验证参数Invoke-Command

\n