powershell 无法连接到 New-PSSession

powershell can't connect to New-PSSession

我正在尝试使用 PS-Session 连接到 intermedia 的 powershell,但我遇到了一个错误。

这是命令

New-PSSession -Name "email@consoto.com" -ConnectionUri http://exchange.intermedia.net/powershell -ConfigurationName Hosting.PowerShell -Credential "email@consoto.com" -Authentication Basic

但是失败并出现以下错误:

The WinRM client cannot process the request. If the
authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the
TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about
that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic

我尝试了什么

我在搜索此问题时尝试将 IP 地址添加到主 Whosebug 网页中提到的受信任主机:Connecting to remote server failed using WinRM from PowerShell powershell v2 remoting - How do you enable unencrypted traffic

PS C:\WINDOWS\system32> winrm set winrm/config/client '@{TrustedHosts="162.244.197.102"}'
Client
    NetworkDelayms = 5000
    URLPrefix = wsman
    AllowUnencrypted = true
    Auth
        Basic = true
        Digest = true
        Kerberos = true
        Negotiate = true
        Certificate = true
        CredSSP = false
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986
    TrustedHosts = 162.244.197.102

Intermedia 实际上有自己的 powershell 脚本,它使用 PS-Session 连接到交换,但它在 powershell.core 上不起作用,因为他们向脚本添加了 Credman 模块。 我正在尝试找到一种方法 运行 PS- 到这个地方的会话,如果可能的话不使用 PS1 脚本。 这是一个 github 的 link 的 powershell 脚本。让我知道我是否缺少任何东西来完成这项工作:https://github.com/Masterjx9/intermediapowershell/blob/main/Hosting.Powershell.ps1

谢谢!

我想通了。我刚刚使用 https: 并且有效。我没想过要尝试这样做,因为 intermedia 的 powershell 模块不使用 https。但这对我有用。

感谢您的宝贵时间,