我正在尝试使用PowerShell远程处理从远程域中的服务器检查某些磁盘大小,但我运行的命令无法正常工作.
情况是这样的:
域B中的服务器正在运行Exchange 2010,我可以使用此命令从服务器A对其运行Exchange 2010特定命令:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri $ConnectionURI -Credential $Credentials -Authentication Basic
Import-PSSession $Session
Run Code Online (Sandbox Code Playgroud)
问题是我无法使用此会话对此服务器运行任何非Exchange命令,如果我尝试然后它说它无法理解命令.我已经检查并使用Invoke-Command运行Get-Command,并且设置为我建立的会话的-Session变量仅返回Exchange命令.
所以我想我会尝试使用Invoke-Command和相关的ComputerName,身份验证类型和凭据,但这是失败的:
Invoke-Command -ScriptBlock {Get-Service} -ComputerName "Servername.destination.com" -Credential $Credentials -Authentication "Basic"
Run Code Online (Sandbox Code Playgroud)
这是错误:
[servername.destination.com] Connecting to remote server failed with the following error message : The WinRM client can
not process the request. The authentication mechanism requested by the client is not supported by the server or unencry
pted traffic is disabled in the service configuration. Verify the unencrypted traffic …Run Code Online (Sandbox Code Playgroud)