You can use the -Server
switch for Get-VM
. i.e.
$server1 = Connect-VIServer server1
$server2 = Connect-VIServer server2
Get-VM -Server $server1
Get-VM -Server $server2
質問
Assuming that i'm connected to more than one VCenters, how do i use the get-vm command for a specific VCenter and not for all?
Eg: im connected to server1 and server2
i want to get the list of all VMs in server 1 and not server 2.
解決
You can use the -Server
switch for Get-VM
. i.e.
$server1 = Connect-VIServer server1
$server2 = Connect-VIServer server2
Get-VM -Server $server1
Get-VM -Server $server2