Hi everyone,
I’m running into a problem with PowerCLI at work.
We run PowerShell as a Citrix Icon. When a user launches it, it starts a fresh PowerShell session, installs a bunch of modules (including PowerCLI), sets proxy settings, etc. Basically, a big initialization script that sets up everything for them. To my knowledge, the Citrix servers already have PowerCLI installed beforehand, maybe updated by SCCM? 🤷♂️
The issue is that for some reason today PowerCLI got completely borked. I’m not a PowerCLI expert myself, and all the people who are know this stuff well are on their summer holidays…
It looks like there’s some sort of version mismatch between VMware.Vim and VMware.VimAutomation.Core. When the script runs, it fails to import VMware.VimAutomation.Core because it says VMware.Vim isn’t loaded.
Here’s what I’m seeing:
Import-Module: \\domain.corp\dfs\AppData\Powershell\powershell-script.ps1:68
Line |
68 | Import-Module -name VMware.VimAutomation.Core
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The required module 'VMware.Vim' is not loaded. Load the module or remove the module from 'RequiredModules' in the file
| 'C:\Users\user\Documents\PowerShell\Modules\VMware.OpenAPI\13.4.0.24798382\VMware.OpenAPI.psd1'.
I checked Get-Module -ListAvailable and found multiple versions of both modules:
[]PS>Get-Module -Name VMware.VimAutomation.Core, VMware.Vim -ListAvailable | ft -AutoSize
Directory: C:\Users\user\Documents\PowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 13.4.0.24798382 VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VITrustedCertificate, Add-VMHost…}
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 8.3.0.24145081 VMware.Vim Desk
Script 8.2.0.22643731 VMware.Vim Desk
Script 8.1.0.21605554 VMware.Vim Desk
Script 8.0.1.20797199 VMware.Vim Desk
Script 7.0.3.19601056 VMware.Vim Desk
Script 13.3.0.24145081 VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer…}
Script 13.2.0.22643732 VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer…}
Script 13.1.0.21606170 VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer…}
Script 13.0.0.20797821 VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer…}
Script 12.7.0.20091293 VMware.VimAutomation.Core Desk {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer…}
If I try manually:
Import-Module -Name VMware.Vim
Import-Module -Name VMware.VimAutomation.Core
I still get:
Import-Module: The required module 'VMware.Vim' is not loaded. Load the module or remove the module from 'RequiredModules' in the file 'C:\Users\user\Documents\PowerShell\Modules\VMware.OpenAPI\13.4.0.24798382\VMware.OpenAPI.psd1'.
Any tips to untangle this mess would be super appreciated 🙏