我的任务是检索有关在远程服务器上运行的所有虚拟机的信息。我在本地计算机上使用PowerShell 5,但远程服务器只有Powershell 2.我的本地计算机有cmdlet Get-VM而远程服务器没有。
这是我尝试过的:
Invoke-Command -ScriptBlock {Get-VM} -ComputerName Remote_Server
但我收到了这个错误:
The term 'Get-VM' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (Get-VM:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : CP-IN-VS01
如果远程服务器没有此cmdlet,获取虚拟机列表的最佳方法是什么?