【发布时间】:2014-12-22 14:01:29
【问题描述】:
我的目标是通过 Powershell 从一个虚拟机运行命令到另一个虚拟机 - 没什么复杂的,对吧?
两台虚拟机在同一个子网,可以互相Ping。如果我打开 mstsc,我可以毫无问题地连接。到目前为止,一切顺利。
这是我的代码(在其他环境中工作,就像一个魅力):
$PSWD = ConvertTo-SecureString $Password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($Username, $PSWD )
$Session = New-PSSession -ComputerName PC000003 -Credential $cred
这就是我得到的 -
New-Pssession : [PC00003] Connecting to remote server PC000003 failed
with the following error message : The WinRM client received an HTTP
status code of 307 from the remote WS-Management service. For more info...
我已经尝试过身份验证开关,没有任何变化。在两个虚拟机之间以及主机和虚拟机之间也尝试了相同的结果,结果相同。在名称和 IP 之间切换 - 结果相同。
用户名和密码正确且具有必要的权限(因为我可以通过 mstsc 成功连接)。 Google 返回很少提及状态码 307,其中大部分是关于 Exchange + Office 365 错误。
有什么想法吗,伙计们?
【问题讨论】:
标签: powershell remote-access remote-desktop