【发布时间】:2014-04-16 21:57:09
【问题描述】:
我有 2 台运行 Windows Server 2012 R2 的服务器。其中一个正在托管运行 Windows 7 32 位的虚拟机,我正在尝试使用另一台服务器查看虚拟机当前正在运行的进程。
我必须使用 Enable-PSRemoting -SkipNetworkProfileCheck 才能正常工作。我还必须将这些计算机添加到彼此的 TrustedHosts 列表中。
Get-Process -ComputerName VM01
将返回“无法连接到远程计算机”。不过,
Invoke-Command -ComputerName VM01 -ScriptBlock {Get-Process}
工作得很好。使用 Invoke-Command 和使用带有 ComputerName 参数的 Get-Process 有什么区别?如果很重要,我也可以毫无问题地使用 Enter-PSSession
【问题讨论】:
标签: powershell powershell-remoting