Updating PowerCLI and Cleaning Up Old Versions

Posted by Stephan McTighe on 9 Apr 2021

Following the recent PowerCLI 12.3 release, I’m sure many will be rushing to make use of some of the great new additions which you can find information on here.

I thought I would quickly show the process of upgrading to the latest version whilst uninstalling any older versions you might still have installed. Partly because I’m playing with creating video content at the moment! Credit to @colinwestwater for his article on how to clean up old versions, blog post here.

Enjoy!

1Update-Module VMware.powerCLI
2
3Get-InstalledModule -Name VMware.PowerCLI | ForEach-Object {
4$CurrentVersion = $PSItem.Version
5Get-InstalledModule -Name $PSItem.Name -AllVersions | Where-Object -Property Version -LT $CurrentVersion
6} | Uninstall-Module -Verbose
7
8Get-Module -Name VMware.PowerCLI