在Widnows 7 PC上,当我在PowerShell中运行Invoke-Command
或Enter-PSSession
时出现错误307。我在受信任区域中有两台计算机。当我在Windows 8.1或Windows Server 2012 R2上运行相同的命令时,我没有错误,命令工作正常。目标运行Windows Server 2012 R2。
他们都运行PowerShell v4.0(对于Widnows 7,我根据MS升级:https://www.microsoft.com/en-us/download/details.aspx?id=40855)。
对于Windows 7:
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.18444
BuildVersion 6.3.9600.16406
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
PS C:\> Enter-PSSession -ComputerName 127.0.0.1
[...]HTTP error 307[...]
+ Enter-PSSession -ComputerName 127.0.0.1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument : (127.0.0.1:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
对于Windows 8.1或Windows Server 2012 R2:
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.34014
BuildVersion 6.3.9600.17400
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
PS C:\> Enter-PSSession -ComputerName 127.0.0.1
[127.0.0.1]: PS C:>
此外,当我使用Test-WSMan
测试连接时,我收到HTTP错误12152.并且两台机器ping另一台。
您对可能的解决方案有所了解吗?
ps:运行Invoke-Command
时的确切英文消息:
[xxxxx] Connecting to remote server srvpwdev01 failed with the following error message : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150859023" Machine="xxxxx"><f:Message></f:Message></f:WSManFault> For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (srvpwdev01:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : -2144108273,PSSessionStateBroken
我在法语Windows中有307号。