Powershell 我的PS版本有什么问题?
“我的服务器”的PS版本为版本3或1,具体取决于请求是在本地shell上完成还是远程完成:Powershell 我的PS版本有什么问题?,powershell,Powershell,“我的服务器”的PS版本为版本3或1,具体取决于请求是在本地shell上完成还是远程完成: Invoke-Command -Session $session { return (Get-Host).Version } "Major": 1, "Minor": 0, "Build": 0, "Revision": 0, "MajorRevision": 0, "MinorRevision": 0, "PSComputerName": "remote.server12345
Invoke-Command -Session $session {
return (Get-Host).Version
}
"Major": 1,
"Minor": 0,
"Build": 0,
"Revision": 0,
"MajorRevision": 0,
"MinorRevision": 0,
"PSComputerName": "remote.server1234567890.com.au",
"RunspaceId": "23634ba8-bfe3-4242-8593-bed3d9aa8ad1",
"PSShowComputerName": true
我在本地服务器上获得PS版本3
PS C:\Users\ea_admin> (Get-Host).Version
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
我在同一台服务器上运行PS版本1(获取主机)。远程版本:
Invoke-Command -Session $session {
return (Get-Host).Version
}
"Major": 1,
"Minor": 0,
"Build": 0,
"Revision": 0,
"MajorRevision": 0,
"MinorRevision": 0,
"PSComputerName": "remote.server1234567890.com.au",
"RunspaceId": "23634ba8-bfe3-4242-8593-bed3d9aa8ad1",
"PSShowComputerName": true
谢谢远程处理使用不同的主机。如果您只是执行
Get Host
,您应该会看到一些其他差异。你应该能够
(获取主机)。版本返回主机应用程序的版本
(获取主机)。Runspace.Version返回PowerShell操作环境的版本