Get-Hostはinvoke-commandで実行すると、なぜか同じバージョン情報を返してくる。Enter-PSSessionで実行しても同じだった。
- PCXX is Windows11.
- PCYY is Windows10.
- localhost is Windows8.1.
PS >(get-host).version
Major Minor Build Revision
----- ----- ----- --------
5 1 14409 1027
PS >$h = ( get-content .\hosts.txt )
PS >$h
PCXX
PCYY
localhost
PS >invoke-command -computername $h -scriptblock { (get-host).version }
Major Minor Build Revision PSComputerName
----- ----- ----- -------- --------------
1 0 0 0 localhost
1 0 0 0 PCXX
1 0 0 0 PCYY
PS >invoke-command -computername $h -scriptblock { [system.environment]::osversion }
PSComputerName : PCXX
RunspaceId : **********
Platform : Win32NT
ServicePack :
Version : 10.0.22621.0
VersionString : Microsoft Windows NT 10.0.22621.0
PSComputerName : localhost
RunspaceId : ***********
Platform : Win32NT
ServicePack :
Version : 6.3.9600.0
VersionString : Microsoft Windows NT 6.3.9600.0
PSComputerName : PCYY
RunspaceId : **********
Platform : Win32NT
ServicePack :
Version : 10.0.19044.0
VersionString : Microsoft Windows NT 10.0.19044.0
Why?