【问题标题】:Error when exiting Powershell Core remote session退出 Powershell Core 远程会话时出错
【发布时间】:2019-10-09 03:29:47
【问题描述】:

当我退出 PowerShell 远程会话时遇到 SOAP 错误,在该会话中我从 Windows 10 系统远程连接到 Ubuntu 16.04 服务器。有没有办法修复或消除此错误?

我收到以下错误:

Closing the remote server shell instance failed with the following error message : <SOAP-ENV:Fault xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Receiver</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>wsman:InternalError</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en-US"/></SOAP-ENV:Reason></SOAP-ENV:Fault> For more information, see the about_Remote_Troubleshooting Help topic.

在 Ubuntu 服务器上,我目前安装了 Open Management Infrastructure 版本 1.4.2-1、PowerShell Remoting Protocol 版本 1.4.1-28 和 PowerShell Core 6.0.1。对于此设置,我按照以下网站上的说明进行操作:https://4sysops.com/archives/powershell-remoting-between-windows-and-linux/

这就是我不断重现错误的方式:

## Setup Credentials to connect to PowerShell on remote Linux server
$credentials = Get-Credential

## Disable cert checking (for now)
$sessionOptions = New-PSSessionOption -SkipCACheck -SkipRevocationCheck -SkipCNCheck

## Start the remote session
Enter-PSSession -ComputerName ServerName -Credential $credentials -Authentication basic -UseSSL -SessionOption $sessionOptions

## Exit out of the remote session
exit

## This is the error I receive on exit:
Closing the remote server shell instance failed with the following error message : <SOAP-ENV:Fault xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Receiver</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>wsman:InternalError</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en-US"/></SOAP-ENV:Reason></SOAP-ENV:Fault> For more information, see the about_Remote_Troubleshooting Help topic.

【问题讨论】:

    标签: powershell


    【解决方案1】:

    对于遇到此问题的其他人,我发现我需要使用“Exit-PSSession”而不是输入“exit”,它可以按预期工作。

    【讨论】:

    • 我很高兴使用Exit-PSSession 解决了问题,但使用exit 的形式也不错:这两个命令应该 可以互换,如果它们'不是,这是一个bug。似乎Exit-PSSession 的存在主要是为了与Enter-PSSession 对称; from the docs: "你也可以使用Exit关键字结束一个交互会话,效果和Exit-PSSession一样"。
    【解决方案2】:

    没有得到解决方案,因为微软在 Exit-PSSession 页面上说 您还可以使用 Exit 关键字来结束交互式会话。效果与使用 Exit-PSSession 相同。 无论如何,即使我运行 Exit-PSSession,我在我的 WIN 2016 上也遇到了同样的麻烦,PS5.1 使用 PS6 远程连接到 SLES x64 12.2。

    【讨论】:

    • 我知道在我的情况下,我在我的 windows 系统和我的 linux 系统上运行 powershell core。我建议在两个系统上运行相同版本的 powershell。
    猜你喜欢
    • 2015-09-02
    • 1970-01-01
    • 2019-03-07
    • 1970-01-01
    • 1970-01-01
    • 2012-04-28
    • 1970-01-01
    • 1970-01-01
    • 2022-01-07
    相关资源
    最近更新 更多