Site icon Digital Thought Disruption

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:


Prerequisites


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

Exit mobile version