远程登录报错 WSMan 服务无法启动主机进程以处理给定的请求。 请确保正确注册了 WSMan 提供程序的主机服务器和代理


PowerShell交流中心分类: Powershell基础远程登录报错 WSMan 服务无法启动主机进程以处理给定的请求。 请确保正确注册了 WSMan 提供程序的主机服务器和代理
0
kuangrenxing asked 6 年 ago

是这样的,我配置了一台server 2012 R2可以远程.本地也是server 2012R2.是正常的. 但是随后配置的另外三台都无法远程有错误.
本地已经设置了信任

Set-Item wsman:\localhost\client\trustedhosts 222.191.133.117

远程也运行了,一路yes

Enable-PSRemoting

测试也是正常的

Test-WsMan 222.191.133.117

测试返回结果:

wsmid : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor : Microsoft Corporation
ProductVersion : OS: 0.0.0 SP: 0.0 Stack: 3.0

 

下面是远程用的代码,不是很明白哪里出了问题.请教了,非常谢谢

$uname="administrator" #administrator为用户名
$pwd=ConvertTo-SecureString "111111" -AsPlainText -Force; #111111为密码
$pcname = '222.191.123.117';
$cred=New-Object System.Management.Automation.PSCredential($uname,$pwd); #创建自动认证对象
Enter-PSSession -ComputerName $pcname -Credential $cred #登录

远程登录,但是有错误如下:

Enter-PSSession : 连接到远程服务器 222.191.133.117 失败,并显示以下错误消息: WSMan 服务无法启动主机进程以处理给定的请求。 请确保正确注册了 WSMan 提供程序的主机服务器和代理。 有关详细信息,请参阅 about_Remote_Troubleshooting 帮助主题。
所在位置 行:7 字符: 1
+ Enter-PSSession -ComputerName $pcname -Credential $cred #登录
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (222.191.133.117:String) [Enter-PSSession],PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed