Working with virtual infrastructures can be a demanding job at times. Especially when there is an increasing demand of applications and workloads always available that need to be running pretty much everywhere! Surely the latest releases of vSphere Clients offer a nice view and management of the virtual infrastructures. What if need to find a more flexible and customizable way to deploy, manage and orchestrate these environments? Simple answer: we need scripting and this is what this article is about. It covers the process to install VMware PowerCLI. Super easy process that takes advantage of the latest PowerShell Core editions.
To install VMwarePowerCLI means benefitting from a seamless user experience when managing the virtual environments regardless if operating from a Windows, Linux or even Mac. Even more it is very simple to update to the latest versions taking advantage of updates to existing modules and access to the new ones.
With VMware PowerCLI in fact, it is possible to manage:
- VMware vCenter from 5.5.0 to 6.7.0
- VMware vSAN from 6.0 to 6.7
- VMware NSX-T from 2.0 to 2.1.0
of course newer releases will include support for future versions as well.
There are plenty of benefits really to install VMwarePowerCLI. Including inventory, management, deployment, automation and orchestration. The bigger the environment the higher flexibility is required. From this perspective scripting allows to go the extra mile.
In particular there are two aspects deemed as important:
- leverage a framework which provides a cross-platform support
- ability to work with Modules and get access to the latest APIs. This is key considering actual infrastructures are evolving from On-Premises Data Centers to Public Clouds in hybrid deployments fashion.
VMware PowerCLI keeps evolving with new cmd-lets and parameters. It is always a good idea to update the installed version and keep an eye to the VMware PowerCLI change log page for the latest details. A Cmd-let reference and a User-Guide are also available.
Install VMware PowerCLI using PowerShell Core
Let’s start the PowerShell Core console as Administrator and issue the command:
Since we are installing this from an “untrusted” repository let’s accept with a “Y” for this instance.
At this point the console will connect to initially download the necessary packages. Let’s confirm and proceed.
At this point PowerShell Core is ready to install all the necessary PowerCLI Modules in the %ProgramFiles%\WindowsPowerShell\Modules
To check the installation of the new VMware PowerCLI modules we can simply issue the command:
“Get-Module VMware* -ListAvailable”
As a first task we can try to connect to the vCenter Server using the Connect-VIServer cmd-let. As screenshot is showing below there are changes on how the latest editions of vSphere handle certificates making it more secure. So let’s make sure the right certificate is installed.
So let’s control the PowerCLI configuration with
With this command we can get information about the Scope, ProxyPolicy and InvalidCertificateAction.
With the “Set-PowerCLIConfiguration” we can change these values as required.
Let’s confirm the change to the ProxyPolicy.
The command now show the current status.
What if want to check and update VMware PowerCLI to the latest version? Very easily all needs to be done is to issue the following commands:
“Find-Module -name VMware.PowerCLI”
“Update-Module -name VMware.PowerCLI”
Similarly we can also use the “Uninstall-Module” command to remove the VMware PowerCLI. When multiple versions are installed this command always remove the latest version first. Of course it is possible to list the versions and remove specific ones:
Uninstall-Module -Name VMware.PowerCLI -RequiredVersion “Version”