How to Install and Update PowerCLI (Windows, macOS, PowerShell Core)

Introduction

Installing PowerCLI is the first step toward automating your VMware environment. But with newer platforms like PowerShell Core, cross-platform usage, and module updates pushed to the PowerShell Gallery, the process can vary slightly depending on your OS.

In this article, you’ll learn:

  • How to install PowerCLI on Windows, macOS, and Linux
  • How to update PowerCLI to the latest version
  • How to verify your installation
  • How to configure essential settings like certificate handling
  • How to troubleshoot common installation issues

Prerequisites

  • PowerShell 7.0+ (Core) or Windows PowerShell 5.1
  • Internet access for downloading modules from the PowerShell Gallery
  • Administrator privileges for system-wide installation (optional)

Step 1: Install PowerCLI on Windows

Open PowerShell as Administrator:

Install-Module -Name VMware.PowerCLI -Scope CurrentUser

If prompted to install from an untrusted repository, type Y to proceed.

Disable invalid certificate warnings (optional in lab):

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Step 2: Install PowerCLI on macOS or Linux (via PowerShell Core)

  1. Open Terminal
  2. Launch PowerShell with pwsh
  3. Run:
Install-Module -Name VMware.PowerCLI -Scope CurrentUser

macOS or Linux does not require special flags, but ensure $HOME/.local/share/powershell/Modules is in your $env:PSModulePath.


Step 3: Verify PowerCLI Version and Module Availability

Get-Module -Name VMware.PowerCLI -ListAvailable

To list submodules:

Get-Module -Name VMware.* -ListAvailable

Step 4: Update PowerCLI to the Latest Version

You can update PowerCLI anytime with:

Update-Module -Name VMware.PowerCLI

If you receive access errors, use:

Update-Module -Name VMware.PowerCLI -Scope CurrentUser -Force

Step 5: Configure Optional Settings

Avoid prompts on first-time module use:

Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false -Confirm:$false

Trust all certificates (for lab environments only):

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Diagram: PowerCLI Install Flow (Cross-Platform)


Use Case: PowerCLI in CI/CD

PowerCLI can be installed inside automation tools (GitHub Actions, Jenkins, Azure DevOps) using:

Install-Module -Name VMware.PowerCLI -Scope CurrentUser -Force
Import-Module VMware.PowerCLI

This enables integration with IaC pipelines, DR testing, or VM provisioning automation.


Troubleshooting PowerCLI Install and Update

ProblemFix
Install fails due to untrusted repoRun Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Access denied errors on updateUse -Scope CurrentUser or run PowerShell as Administrator
Import-Module failsUse Import-Module VMware.PowerCLI -Force
Certificate warning on connect-viserverRun Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

Tips for Managing Multiple Versions

  • Use Remove-Module before importing a different version
  • Use $PSVersionTable to verify PowerShell Core vs Windows PowerShell
  • Keep your modules up to date across platforms using scheduled scripts

Leave a Reply

Discover more from Digital Thought Disruption

Subscribe now to keep reading and get access to the full archive.

Continue reading