/ #powercli 

PowerCLI Installation and Update using PowerShell Gallery Memo

PowerCLI Logo

Since PowerCLI 6.5.1, you no longer have a MSI file to download and install: you can now install directly from the PowerShell Gallery. When using this system, the install is done completely through PowerShell itself using the PowerShell Gallery via PowerShellGet.

I’m using this post as a memo for various tips and info about the installation and update of PowerCLI via the PowerShell Gallery.

Pre-requisites:

  • Uninstall any existing version of PowerCLI
  • PowerShell 5.0 or above
  • Administrator rights

To check your current PowerShell version, use $PSVersionTable.PSVersion.

Get PowerShell version using $PSVersionTable.PSVersion

…or the Get-Host cmdlet.

Get PowerShell version using Get-Host cmdlet

  • You need to update PowerShell if your version is below 5.0. The reason is that the Install-Module cmdlet is missing from versions below 5.0. To get there, update the Windows Management Framework 5.1 (which includes PowerShell).
  • If asked to install or update ‘NuGet Provider’, choose ‘Y’ to install or to get the newer version.
  • If you start a Powershell session without administrator rights, you will get the following error message:

PowerShell Gallery: Install-Module requires Administrator rights

Useful commands:

  • Find-Module -Name VMware.*
  • Install-Module -Name VMware.PowerCLI -Scope AllUsers: install in a location that is accessible to all users
  • Install-Module -Name VMware.PowerCLI -Scope CurrentUser: install in a location only available to the current user
  • Update-Module -Name VMware.PowerCLI
  • Get-Module -Name VMware.* -ListAvailable : get installed modules and available modules

Get PowerShell Installed Modules and Available Modules starting with VMware.* (PowerCLI for ex)

Additional resources:

Also, a quick note to end: PowerNSX is also available through PowerShell Gallery. #runNSX ;)

Author

Romain

Staff II Technical Product Manager, technologist with 18+ years of Networking and Security experience in Data Center, Public Cloud & Virtualization (VMs and Containers). He is a double VCDX (DCV and NV, #120), VCDX panelist, frequent VMUG/VMworld speaker and contributor to the community via this blog or social media (follow him on Twitter @woueb).