小编Nic*_*ley的帖子

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

我正在尝试运行以下命令

$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)

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

谢谢

powershell powershell-remoting

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

powershell ×1

powershell-remoting ×1