For all those scripting engineers, here is a nice one. Accessing your VCenter via PowerCLI. When you have to look for bunch of networks, IP’s , MAC Addresses or generally properties on a large base, PowerCLI to the rescue. Here is how you can connect to your VCenter or Node via PowerCLI. It is a module which can be run on Powershell. In order to run this, you will need to ensure that you have PowerShell Version 4 and higher. In order to check, run Powershell as Administrator. Then run the following command:
The “Major” will display the version. Then next steps would be to install the module. On the older Powershell Versions, you do not have selected modules which contains the GET / SET etc. Next to install the VMWare.Powercli module
Command: Install-Module VMware.powercli
It will then advise to install from an untrusted repository. Because it is coming from a NON Microsoft repository, which is still safe to go ahead. Select “A” and continue.
It will begin downloading and installing the various modules to manage your VMWare VCenter. The next few slides will show the various steps and modules it will be downloading and installing.
Upon a successful installation, it will resume back to the cursor.
Then depending on the setup, sometimes you can get invalid certificate which will not allow you to connect. Run the following command to ignore ONLY if you know and trust the VCenter or Node you are connecting to.
Command: Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
Now you are ready to connect to your VCenter or Node. Run this command to connect to your VCenter or Node:
Command: Connect-VIServer <VCenter or Node FQDN / IP>
You will then be prompted for the credentials and you’re in.
If you wish to know what modules were installed, run the following:
Command: Get-Module -ListAvailable -Name VMware*
Happy VMware Management….