VI Toolkit / PowerShell : How to connect to more than one Virtual Center
Hello All,
First thing, the documentation on VI Toolkit :
http://communities.vmware.com/docs/DOC-4210
If you want to connect to more than one virtual center at the same time, here the starting code :
1 2 3 4 5 6 7 | $vcs = @() $vcs += connect-viserver <vc 1> $vcs += connect-viserver </vc><vc 2> # You could add many as you need... # Command example : Snapshot all VMs across all VirtualCenter servers. get-vm -server $vcs | new-snapshot |
Be carrefull, the command GET-VM $VCS will not return the same values than GET-VM.
If you use GET-VM, you will receive the VM List only for the Virtucal Center that you connect last. If you want the get all the VM of your different virutal centers, you absolutly need to add the parameter -server $vcs to you command. In a general way, don’t forget to add -server $vcs to every command than you use with the VI Toolkit.

