Loading
TAG | virtual center
May/10
20
VI Toolkit / PowerShell : How to connect to more than one Virtual Center at the same time
No comments · Posted by Christopher Keyaert in PowerShell, VMWare
Hello All,
If you only use the command GET-VM, you will receive back the VMs List only from the Virtucal Center that you last connect on. If you want the get all the VM from your both virutal centers, you absolutely need to add the parameter -server $vcs to you command.
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 vc1.mydom.local $vcs += connect-viserver vc2.mydom.local # You could add many as you need... # Command example get-vm -server $vcs | export-csv C:\Export.csv |
In a general way, don’t forget to add -server $vcs to every command than you use with the VI Toolkit.
As always, RTM -> the documentation on VI Toolkit :
http://communities.vmware.com/docs/DOC-4210
Christopher Keyaert
PowerShell · script · virtual center · VMWare
