命令返回从PowerShell远程从域服务器和工作站

问题描述:

我得到在PowerShell远程的“REPADMIN/replsum”命令不同的输出不同的输出:命令返回从PowerShell远程从域服务器和工作站

使用PowerShell远程处理,我正从一个域服务器中运行时:

Replication Summary Start Time: 2017-02-19 04:55:04 
Beginning data collection for replication summary, this may take awhile: 
    ..... 
Source DSA   largest delta fails/total %% error 
DC1     12h:12m:59s 1/ 5 20 (1908) Could not find the domain controller for this domain. 
DC2      01m:12s 0/ 5 0 

Destination DSA  largest delta fails/total %% error 
DC1      01m:12s 0/ 5 0 
DC2     12h:12m:59s 1/ 5 20 (1908) Could not find the domain controller for this domain. 

同一个用户,我从工作站使用PowerShell远程运行REPADMIN/replsum,我越来越:

Replication Summary Start Time: 2017-02-19 04:55:47 
Beginning data collection for replication summary, this may take awhile: 
    ..... 
Source DSA   largest delta fails/total %% error 
DC2      01m:55s 0/ 5 0 
Destination DSA  largest delta fails/total %% error 
DC1      01m:55s 0/ 5 0 
Experienced the following operational errors trying to retrieve replication information: 
     110 - DC2.kono.com 

为什么当我使用相同的用户和目标服务器(这是一个域控制器) psremoting时,结果是不同的?

在此先感谢

嵌套PowerShell会话似乎解决了问题:

$Password = convertto-securestring "mypassword" -asplaintext -force; 
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "kono\administrator",$Password; 
Invoke-Command -ComputerName $ip -Credential $cred -ScriptBlock { 
$Password = convertto-securestring "mypassword" -asplaintext -force; 
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "kono\administrator",$Password; 
Invoke-Command -ComputerName dc2 -Credential $cred -ScriptBlock {repadmin /replsum} 
}