Featured image: PowerShell 7 and VCF PowerCLI on a jump host, without the version mix
| | |

PowerShell 7 and VCF PowerCLI on a jump host, without the version mix

On an air-gapped jump host at a customer, a script that had worked everywhere else stopped at its first line of PowerCLI: “The required module ‘VMware.VimAutomation.Sdk’ with version ‘13.5.1.25718932’ is not loaded.” The host had PowerCLI 11.5, 13.3 and an incomplete offline copy of VCF.PowerCLI 9.1.1, spread over three module folders. Each one on its own was fine. Together they broke the import.

That’s the most common way a VCF 9 jump host goes wrong, and it’s avoidable. This post walks through what to install, how to do it with and without internet access, how to check the result, and how to clean up a host that already has a mix. The full build guide, with every command and source, is on my planning site: Jump host: PowerShell 7 and VCF PowerCLI.

What to install

  • PowerShell 7.6 LTS. Broadcom: “PowerShell 7.4 or later is officially supported and is our minimum recomended version for use” (PowerCLI Installation Guide). Microsoft ended support for 7.4 and 7.5 on 10 November 2026; 7.6 LTS is supported until 14 November 2028 (PowerShell Support Lifecycle). Use the MSI on a jump host: “Best choice for Windows Servers and enterprise deployment scenarios.” PowerShell 7.7.0 came out on 10 November without an MSI, so stay on 7.6 for now.
  • VCF.PowerCLI 9.1.2, not VMware.PowerCLI. “Make sure that you are installing VCF.PowerCLI and not VMware.PowerCLI.” For vCenter 9, check the matrix in KB 428547. Version 9.1.2 came out with VCF 9.1.2 and turns the PowerShell recommendation into a hard floor: “The minimum supported version for the PowerShell Core edition is now PowerShell 7.4.0” (PowerCLI 9.1.2 release notes).
  • Leave Windows PowerShell 5.1 alone, but don’t use it for PowerCLI. VCF PowerCLI 9.x needs “PowerShell 7.0.13 +”; on 5.1 it fails at run time with “Could not load file or assembly ‘Newtonsoft.Json…'” (KB 409981).

One trap before you start: the PowerShell Gallery lists 5.1 as the minimum version for VCF.PowerCLI, so Install-Module happily installs it from Windows PowerShell. The install succeeds, the cmdlets fail later. Always install and run it from pwsh.

With internet access

Install the PowerShell 7.6 MSI, open pwsh, and:

Install-Module -Name VCF.PowerCLI -Scope CurrentUser
Set-PowerCLIConfiguration -Scope User -ParticipateInCeip $false

On a shared jump host, -Scope AllUsers from an elevated session saves every engineer a separate install. Coming from VMware.PowerCLI 13.3 or earlier, Broadcom recommends a clean install: remove the old one first (see the clean-up below).

Without internet access

Carry three things across: the PowerShell MSI, the VCF PowerCLI zip from developer.broadcom.com (check the MD5 on the download page), and the fleet CA certificate. Then two steps decide whether it works:

  • Unblock the zip before you extract it. Files downloaded with a browser carry a Mark of the Web, and everything extracted from a marked zip inherits it. Blocked module files don’t load, and unblocking them afterwards in Program Files needs admin rights. Unblock-File on the zip first, and nothing extracted from it is blocked.
  • Extract to the PowerShell 7 module path, $Env:ProgramFiles\PowerShell\Modules (all users) or $HOME\Documents\PowerShell\Modules (one user). Not WindowsPowerShell\Modules: that’s the 5.1 path, and it’s where old PowerCLI versions tend to live. The module folders must land directly in that path, not in a subfolder named after the zip.

An alternative to the zip is Save-Module -Name VCF.PowerCLI on a connected machine, and carrying the saved folders across. On release day of 9.1.2 that was the only offline route to it: the PowerShell Gallery had 9.1.2, the download page still only the 9.1.1 zip. Either way, an offline install can’t be updated online: “perform an offline installation of the latest PowerCLI version”, after removing the old one.

Check the result

VCF.PowerCLI 9.1.1 and 9.1.2 each pin 36 submodules, each to an exact version. One missing or shadowed submodule fails the whole import. In a clean pwsh -NoProfile, this lists only what’s missing (no output means complete):

$psd = (Get-Module -ListAvailable VCF.PowerCLI | Sort-Object Version -Descending | Select-Object -First 1).Path
(Import-PowerShellDataFile $psd).RequiredModules | ForEach-Object {
  $req = $_; $all = Get-Module -ListAvailable $req.ModuleName -All
  [pscustomobject]@{ Module = $req.ModuleName; Required = $req.RequiredVersion
    Present = [bool]($all | Where-Object { $_.Version -eq $req.RequiredVersion })
    Found = (($all.Version | Sort-Object -Unique) -join ', ') }
} | Where-Object { -not $_.Present } | Format-Table -AutoSize

Then Import-Module VCF.PowerCLI, and check with Get-Module that every VMware module comes from the path you chose, at one version.

Why a mix breaks

Back to the jump host from the start. Four things combine:

  • VCF.PowerCLI pins exact versions, but the submodules ask each other only for a minimum. And “By default, PowerShell loads the highest version number of a module when multiple versions are found” (about_PSModulePath). With several versions installed, a session can end up with a mix.
  • pwsh also reads the Windows PowerShell paths. A PowerCLI installed for 5.1 years ago is still in play under PowerShell 7.
  • One version of a module per session. Once an old PowerCLI assembly is loaded, by a profile or an earlier command, it blocks the new one until the session ends.
  • Unversioned folders from a manual copy hold one version only, and a copy in an earlier module path shadows a later one.

After a partial fix the error changed to “Exception calling “OnImportModule” … Value cannot be null. (Parameter ‘type’)”, which says nothing about versions at all. The answer is one PowerCLI version per jump host, and tools started from pwsh -NoProfile.

Cleaning up

Broadcom’s own procedure is to close every session that has PowerCLI loaded, find the modules with Get-Module -ListAvailable VMware*, and delete them (Uninstall VCF PowerCLI). Two things to add: that filter misses the VCF.PowerCLI module itself, and VMware.vSphere.SsoAdmin starts with VMware but isn’t part of PowerCLI.

The guide has two routes. Route A removes everything and installs once, for a host you don’t trust. Route B keeps a complete VCF.PowerCLI and removes everything outside its dependency tree. In my lab, Route B took out an old VMware.PowerCLI 13.3.0 set of 83 modules in one run, and Import-Module VCF.PowerCLI loaded cleanly afterwards. Only what Install-Module installed can go with Uninstall-Module; copies from a zip are folders you delete yourself. Route B is also the step after every update. In my lab, Update-Module from 9.1.1 to 9.1.2 left the whole 9.1.1 set in place: 38 PowerCLI modules before, 74 after. Route B then removed exactly the 36 modules of 9.1.1 in one run. Both routes, with the commands, are in §7 of the guide.

What my toolkits do about it

I first tried to work around a mixed host inside a script, by loading one complete PowerCLI build from the module manifests. It worked, and it hid the problem: every other tool on that host still failed. So I dropped it. My vCenter toolkits (VIRoleManager, StoragePolicyManager, VIFolderManager, VITagManager and VDSPortGroupManager) now need PowerShell 7.4 or later, import only the PowerCLI module they use, and stop up front when PowerCLI modules of different versions are already loaded, with a pointer to the clean-up.

The takeaway

PowerShell 7.6 from the MSI, VCF.PowerCLI from pwsh, one version per host, and a check that every pinned submodule is there. Most of the time lost on a jump host goes on the step that should take ten minutes. If you’ve seen a PowerCLI import error I haven’t covered here, let me know and I’ll add it to the guide.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *