Want to use VMware PowerCLI to get some information or perform a script? First things first, you have to connect the application to something. Now the choice is up to you, a Host or a vCenter server? I would always go with the vCenter server as you can specify specific hosts but its up to you!
The tips at the top are very helpful when the application is opened.
In basic terms run the following command changing the text in italics to the name of your host or vCenter
Connect-VIServer Servername
Once you have connect to the host/vCenter once you can the following command to be lazier about typing in a hostname!
Connect-VIServer -Menu
Once this command is run it will ask you for a number (A list will display a number against a hostname) input the number and hot enter.
This will then load and probably give you a load of rubbish about certificates and the version your running. To test you are connected just run a simple command if you connected to a vCenter server
Get-Datacenter
This will list all of your Datacenter’s in your vCenter server, Note if you connected to a host this will not work.
Leave a Reply