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

Start here: Which PowerCLI package do you need?

For new installations or a move to VCF.PowerCLI, use the VCF PowerCLI 9.1 installation and migration guide alongside Broadcom’s current instructions. The commands below are retained for the older VMware.PowerCLI package.

Maintaining an existing legacy environment? Jump to version checks, legacy-package updates, or troubleshooting. Package migration requires a separate compatibility and script-import review.

Introduction

This article retains the VMware.PowerCLI package workflow for existing scripts and environments that still depend on it. It is a legacy-package reference, not the installation path for the current VCF.PowerCLI package.

In this article, youโ€™ll learn:

  • Install the legacy VMware.PowerCLI package on a compatible Windows, macOS, or Linux environment
  • Inspect installed modules and plan an update within the legacy package
  • Keep server-certificate validation enabled
  • Recognize when to use the separate VCF PowerCLI migration guide

Prerequisites

  • Check the compatibility requirements for the exact legacy PowerCLI release and operating system you intend to use; do not assume every PowerShell version works.
  • For current VCF PowerCLI, Broadcom’s installation guide recommends supported PowerShell 7.4 or later and flags Windows PowerShell 5.1 as being deprecated.
  • Use an approved module repository and confirm network access. A CurrentUser install is user-scoped; a system-wide installation requires the appropriate administrative rights.

Step 1: Install PowerCLI on Windows

For a deliberately selected legacy-package installation, open a compatible PowerShell session. The example below uses CurrentUser; an elevated Administrator session is not required for that scope.

Install-Module -Name VMware.PowerCLI -Scope CurrentUser

Before accepting a repository prompt, inspect Get-PSRepository -Name PSGallery and verify the repository against your organization’s approved source. Approve only the intended installation; do not change repository trust merely to suppress a warning.

Before connecting to a server, inspect the effective PowerCLI settings. The following command is read-only:

Get-PowerCLIConfiguration

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

Use $env:PSModulePath to inspect this session’s module search paths if discovery fails. Keep the installation account, PowerShell edition, and module location consistent; do not copy modules between paths without checking the release’s installation guidance.


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 the Legacy VMware.PowerCLI Package

First inspect the package recorded by PowerShellGet. Update-Module applies to modules installed through Install-Module, not a module folder copied from an offline ZIP. See Microsoft’s Update-Module reference.

Get-InstalledModule -Name VMware.PowerCLI | Select-Object Name, Version, InstalledLocation

If this is an approved, user-scoped legacy installation, the following updates that package to the newest version available under the VMware.PowerCLI name. Test the change before production use; it does not migrate the installation to VCF.PowerCLI. An access error needs a scope and ownership check, not an automatic forced retry.

Update-Module -Name VMware.PowerCLI -Scope CurrentUser

Step 5: Configure Optional Settings

Optional: if your organization’s policy is to decline CEIP participation, the following sets that preference for the current user. It is not a general fix for connection or installation prompts:

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

Keep certificate validation enabled. This example explicitly rejects invalid server certificates for the current session. If a connection fails, correct the certificate validity, server name, and trusted issuing chain before reconnecting. See the PowerCLI configuration reference.

Set-PowerCLIConfiguration -Scope Session -InvalidCertificateAction Fail

Historical Diagram: VMware.PowerCLI Install Flow

Diagram of PowerCLI Install Flow (Cross-Platform).

Use Case: PowerCLI in CI/CD

For an existing legacy-package pipeline, build and test a runner with an approved module set before the job runs. This example imports that pre-provisioned package; it does not download or update modules during every job. Manage version selection and upgrades as reviewed runner changes.

Import-Module -Name VMware.PowerCLI -ErrorAction Stop

This can support IaC pipelines, DR testing, or VM provisioning automation. If more than one version is installed, select the tested version explicitly with -RequiredVersion and validate the complete module set.


Troubleshooting PowerCLI Install and Update

ProblemWhat to check
Repository warningVerify Get-PSRepository -Name PSGallery against an approved source before accepting the install. Do not blanket-trust a repository just to silence prompts.
Access denied during updateInspect InstalledLocation and the account that owns the installation. Use the appropriate scope; do not add -Force as a permission workaround.
Import fails or versions conflictRecord the exact error and installed versions. Test in a fresh PowerShell session; for migration, follow Broadcom’s VCF PowerCLI installation guide.
Invalid certificate on Connect-VIServerCorrect the server certificate and trust chain. Keep invalid-certificate behavior set to Fail.
Offline installation cannot be updatedUse the release’s offline installation procedure; a copied module folder is not an online PowerShellGet installation.

Tips for Managing Multiple Versions

  • Record $PSVersionTable and installed module versions when diagnosing a failure.
  • Test a different module set in a fresh PowerShell process. Removing a module does not reliably reset everything loaded into that process.
  • Schedule an inventory and compatibility review; promote tested module updates through change control rather than automatically updating production runners.

Continue reading

PowerCLI Script to Automatically Shut Down VMs in Case of Outage

Explore another guide in this topic and build on what you have just read. Read the article

2 thoughts on “How to Install and Update PowerCLI (Windows, macOS, PowerShell Core)”

Leave a Comment