Along this journey you will learn :
- How to spot historical versions of PowerCLI that you may encounter in legacy scripts
- How to install the most recent version of PowerCLI
- Use VMware Code as a resource
- How to install VMware PowerCLI across both Windows PowerShell 5.1 and PowerShell 6/7 for cross-platform use.
“ In most respects, VMware PowerCLI is the most consistent administrative interface in the hypervisor ’ s tenured history. ”
The above paraphrased remark was shared about the resilience and importance of PowerCLI in a system administrator ’ s toolkit. It was shared during a VMware PowerCLI seance at the PowerShell Summit in 2019.
Interfacing with vSphere and VMware has gone through a multitude of iterations, from the original software client, flash node, HTML5 and bend web-client versions. In each new publish, the interfaces changed in frequently buggy or feature-lacking ways .
On the flick side, VMware PowerCLI ’ s syntax has remained static throughout its lifecycle with alone one distribution exchange. That adult deepen was the transition from a PowerShell snapin to PowerShell module .
PowerCLI is efficaciously the last valet standing for consistency ’ s sake when administering VMware products .
- From Snapin to no Public Access
- Downloading VMware PowerCLI
- Installing VMware PowerCLI in Windows PowerShell
- Installing VMware PowerCLI in PowerShell 6 on Linux
- Installing the Legacy VMware PowerCLI Snapin
- Verifying Installation of PowerCLI
- Go Forth and PowerCLI!
- Further Reading
From Snapin to no Public Access
The master download location for VMware PowerCLI was behind a PowerCLI 5.1 page connection. Because of this limitation, the public alone had limited entree to this tool .
PowerCLI 5.1 and earlier was besides a PSSnapin preferably than a module making portability much more difficult. As a follower of this web log, you ’ ll likely recognize this as a bequest format for such tools. Because of the cumbersome installation steps, snapins proved more difficult to get mass-adoption of PowerCLI. Lucky for you, PowerCLI as of the latest interpretation 6.0 ships as a PowerShell module, and not a snapin !
With that exhaust of PowerCLI 6.0 in September of 2015, the plot had begun to change. This translation was the first iteration released as a PowerShell module, shipping with about 400 cmdlets full. however, the indigence for a my.vmware.com account was even present until version 6.5.1 released on 4/20/2017 to the PowerShell Gallery .
In the current version ( 11.3.0 ) of VMware PowerCLI, the module has precisely under 700 cmdlets for administrative coverage over a multitude of VMware products. Those products include vCenter, vCloud Director, VMware Horizon, and many others .
The tilt of cmdlets continues to grow with the VMware portfolio, but the test and true PowerCLI standards are holding hard like a force of consistency .
Cmdlets in the PowerCLI PowerShell module
We ’ re about ready to jump into a demonstration so be surely you have all of these prerequisites so you can follow along with me .
- VMware host or vCenter server for validation testing
- Windows, Mac, or Linux client machine
Downloading VMware PowerCLI
The newly retentive term dwelling for the PowerCLI plan team is set at this associate. Any and all residential district raised feature requests, comments, and documentation for this module are now separate of the same web site as the SDK, API, and authentication resources .
If you have any questions or wish to raise feature requests directly with the team, you can reach out to both the PowerCLI team and the community surrounding this project at code.vmware.com. Both the community and VMware project team are highly responsive to questions, concerns, and raw ideas as they arise .
If you ’ d like to perform a PowerCLI download via the web, the PowerCLI team provides a direct associate to two options for their PowerShell module :
- The PowerShell Gallery link to download and install using PowerShell’s package manager
- A .zip archive of the module’s contents, to be manually installed
The PowerShell Gallery is, by far, the most common room to download PowerCLI but the travel rapidly archive will besides work. Note that you don ’ t have to use the PowerShell Gallery radio link here. You can besides download it via PowerShell .
Installing VMware PowerCLI in Windows PowerShell
There are a few different ways to install PowerCLI .
Extracting the ZIP file
If you ’ ve downloaded it via the web from the aforesaid page, you ’ ll indigence to manually install it. You must get PowerCLI in a descry where PowerShell can see it .
To install the module via the provide travel rapidly box, you ’ ll necessitate to extract the contents to the module localization of choice. This placement will either be your user profile placement ( for non-administrative scope ) or to the system-wide modules folder .
%UserProfile%\Documents\WindowsPowerShell\Modules C:\Program Files\WindowsPowerShell\Modules
Extract the .zip contents to one of the above locations .
The easiest and fastest way you can download and install PowerCLI today is to use download the module from the PowerShell Gallery within a PowerShell console table. Below you will find a immediate television on the general installation steps for a newfangled module to PowerShell with this method acting.
Read more: How to install Java on Linux
But, all-in-all, you can perform the following from an administrative PowerShell prompt to get the job done .
PS51> Install-Module VMware.PowerCLI
If you ’ d like to perform a PowerCLI install on a workstation where you lack administrative privileges, you can use the
Scope argument to install the module into your user visibility module way .
PS51> Install-Module VMware.PowerCLI -Scope CurrentUser
Installing VMware PowerCLI in PowerShell 6 on Linux
Nowadays, you can besides install PowerCLI on non-Windows systems. For exemplar, we can install PowerCLI in PowerShell Core on Ubuntu. Again, depending on if you ’ ve chosen to download the zip up file, the PowerShell Gallery ’ s web radio link or immediately via the PowerShell cabinet, the facility work is a little different .
Extracting the ZIP file
Depending on the season of Linux, you will extract the .zip file contents to different locations .
Open up PowerShell on Linux by running pwsh in your concluding. Locate the potential PSModulePath locations using the trace control :
Directories in PSModulePath once you ’ ve determined where you would like to install the module files, download them to that localization and cook for the unzip. You ’ ll either unzip them to the /home/ booklet for drug user entree or the /opt/ localization for system access .
For this example of a Linux-based facility, I ’ megabyte using Ubuntu 18.04 and will install VMware PowerCLI 11 using the .zip file downloaded from here, installing the module to be accessed by all users of this machine .
> cd /opt/microsoft/powershell/6/Modules > sudo apt install unzip > sudo wget https://vdc-download.vmware.com/vmwb-repository/dcr-public/8bf09c32-43c0-46d4-8816-92515c3b8228/15761272-b339-4da4-888a-4b8633f9a964/VMware-PowerCLI-11.3.0-13990089.zip > sudo unzip ./VMware-PowerCLI-11.3.0-13990089.zip
You can then import this module, because the faculty files are now in one of your
$PSModulePath locations, via a normal execution of :
Installing the Legacy VMware PowerCLI Snapin
sometimes you may find yourself having to install the older PowerCLI snapin. possibly you have taken over responsibility for some bequest code and need to troubleshoot problems. To prevent re-architecting your existing scripts, it ’ randomness necessity to install the old snapin .
To install the old snapin, you ’ ll need a my.vmware.com account to login and retrieve the VMware-PowerCLI-5.1.0-3090428.exe file. Upon download, install the snapin via the feasible through a normal Windows application facility .
You can then run
Add-PSSnapin to load the VMware cmdlets into your seance, or launch the leave VMware PowerCLI console table in a stand-alone fashion .
Below you can see I ’ molarity using the
Add-PSSnapin cmdlet to add PowerCLI adaptation 5.1 to my current console school term .
PS51> Add-PSSnapin VMware*
PowerCLI snapins Launching the install stand-alone VMware PowerCLI shortcut that gets installed with version 5.1 .
PowerCLI v5.1 console note that the above snapin is not compatible with PowerShell 6/7 .
Verifying Installation of PowerCLI
Verifying your installation of PowerCLI as successful is the same, regardless of your interpretation of PowerShell. The first tone, confirm the presence of the modules from the PowerShell cabinet .
Get-Module -ListAvailable VMware*
Available PowerCLI modules future, attempt to use PowerCLI to connect to vCenter with the
Connect-VIServer cmdlet. This will not alone verify the module was installed successfully, it will besides test whether or not you connect to your infrastructure correctly.
Read more: How to install Java on Linux
Connecting to vCenter with VMware PowerCLI on Windows
When verifying facility on Linux, you must foremost set the association configuration to account for an invalid ( or default self-signed security ) if you encounter any association issues. Below I am using PowerCLI to connect to vCenter .
PS> Set-PowerCLIConfiguration -InvalidCertificateAction:ignore PS> Connect-VIServer
Connecting to vCenter with VMware PowerCLI on Linux Since you were able to successfully connect to your VMware end point, the PowerCLI is successfully up and prevail !
Go Forth and PowerCLI!
From this point on, you are now prepared to answer that proverbial motion of “ How do I install VMware PowerCLI ? ”. You can now begin working on scripting out your shape deployments, VM Reports, and care tasks. Stay tuned to this web log for new and approaching articles on getting started with PowerCLI !