无法建立HTTP或HTTPS远程会话

时间:2017-11-07 08:31:36

标签: powershell networking winrm pywin remote-management

我正在为ansible启用Windows节点。为此,我使用以下命令在Windows 7中启用http和https远程会话。

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://github.com/ansible/ansible/raw/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))"

我在办公室收到以下错误。

你能帮帮我吗?

在另一台笔记本电脑的家里工作正常。

+     Throw "Unable to establish an HTTP or HTTPS remoting session."
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Unable to estab...moting session.:String) [], RuntimeException
    + FullyQualifiedErrorId : Unable to establish an HTTP or HTTPS remoting session.

我尝试了以下选项:

set http_proxy=http://lsl5kor:N%40llapat12@jk-proxy-apac.india.com:8080/
set https_proxy=http://lsl5kor:N%40llapat12@jk-proxy-apac.india.com:8080/

set http_proxy=http://lsl5kor:N@llapat12@jk-proxy-apac.india.com:8080/
set https_proxy=http://lsl5kor:N@llapat12@jk-proxy-apac.india.com:8080/

set HTTP_PROXY=http://lsl5kor:N@llapat12@jk-proxy-apac.india.com:8080/
set HTTPS_PROXY=http://lsl5kor:N@llapat12@jk-proxy-apac.india.com:8080/

set HTTP_PROXY=http://lsl5kor:N%40llapat12@jk-proxy-apac.india.com:8080/
set HTTPS_PROXY=http://lsl5kor:N%40llapat12@jk-proxy-apac.india.com:8080/ 

我尝试了以上所有细节......但是没有工作

更新

似乎已创建连接(已登录)。我在windows机器中观察了下面的事件日志

The WinRM service has received an unsecure HTTP connection from hostname. 

 This is not a secure configuration. 

 User Action 
 Set AllowUnencrypted to False in WinRM configuration to ensure packets are encrypted on the wire.

提前致谢。

1 个答案:

答案 0 :(得分:1)

你可能落后于代理人。如果是这样,请先尝试设置代理:

set http_proxy=IP:Port
set https_proxy=IP:Port

或者您可以转到Control Panel->Internet Options->Connections->LAN Settings->Proxy servers

所有在一起:

set http_proxy=IP:Port
set https_proxy=IP:Port

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://github.com/ansible/ansible/raw/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'))"