【发布时间】:2010-11-30 23:39:02
【问题描述】:
我正在编写一个我想在远程服务器上运行的 powershell v2 脚本。当我运行它时,我得到了错误:
连接远程服务器失败 带有以下错误消息: WinRM 客户端无法处理 要求。未加密的流量是 目前在客户端禁用 配置。换客户端 配置并尝试请求 再次。有关详细信息,请参阅 about_Remote_Troubleshooting 帮助 主题。
我查看了有关 _Remote_Troubleshooting 的在线帮助,但它并没有指出如何启用未加密的流量。下面是我正在使用的导致我出现问题的脚本。
注意:我已经在远程机器上运行了 Enable-PSRemoting 以允许它接受传入的请求。
我尝试使用会话选项变量,但似乎没有任何区别。
$key = "HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds"
Set-ItemProperty $key ConsolePrompting True
$tvar = "password"
$password = ConvertTo-SecureString -string $tvar -asPlainText –force
$username="domain\username"
$mySessionOption = New-PSSessionOption -NoEncryption
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
invoke-command -filepath C:\scripts\RemoteScript.ps1 -sessionoption $mySessionOption -authentication digest -credential $credential -computername RemoteServer
如何启用未加密的流量?
【问题讨论】: