Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以在使用PowerShell的远程计算机上调用本地cmdlet吗?_Powershell - Fatal编程技术网

我可以在使用PowerShell的远程计算机上调用本地cmdlet吗?

我可以在使用PowerShell的远程计算机上调用本地cmdlet吗?,powershell,Powershell,我的任务是检索远程服务器上运行的所有虚拟机的信息。我在本地计算机上使用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, func

我的任务是检索远程服务器上运行的所有虚拟机的信息。我在本地计算机上使用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,获取虚拟机列表的最佳方法是什么?

是否
get vm-computername remote\u server
不工作(从本地计算机)它不工作。我收到以下错误:
getvm:WS-Management服务无法处理该请求。DMTF资源URI用于访问非DMTF类。请使用非DMTF资源URI重试。
您是否尝试过通过WMI执行类似操作$VSMgtSvc=Get WmiObject-ComputerName'CP-IN-VS01'-名称空间“root\virtualization”-类“MsVM\u virtualSystemManagementService”我没有,但这并不是我想要的,您必须在远程计算机上启用远程执行,才能使任何远程命令正常工作。在配置中,您只能允许本地计算机执行命令。出于安全考虑,PowerShell default将关闭此选项。