Windows Admin Center WAC giving error CimCmdLets was not loaded

When using Windows Admin Center to connect to servers, it can happen that a server pops up an error while connecting saying something like “The specified module ‘CimCmdLets’ was not loaded because no valid module file was found.” It happened to me with one of 2 identical servers, or which would be identical in theory at least. I could not find much about the error while searching for it with the specific cmdlet name. Turns out that its possible that the file is on your system, but the path where it tries to look for it is not defined.

In that case go to the server and open up an elevated PowerShell and look for the contents of the environment variable by just typing this command:

$Env:PsModulePath

It usually gives a few items in a long string separated by semicolons.
Check if “C:\Windows\system32\WindowsPowerShell\v1.0\Modules” is missing from that list. Or run the same command on both a working and not working server and see which entry is different to establish which entry you want to add.

If it is missing we should add the module path to the environment variable.

I found the command needed on this page on the docs site: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psmodulepath?view=powershell-7.1
And adjusted it to my need for the relevant path for my case. Best is to save this in a ps1 file on the destination server and run it from an elevated prompt.

$key = (Get-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager’).OpenSubKey(‘Environment’, $true)
$path = $key.GetValue(‘PSModulePath’,”,’DoNotExpandEnvironmentNames’)
$path += ‘;C:\Windows\system32\WindowsPowerShell\v1.0\Modules’
$key.SetValue(‘PSModulePath’,$path,[Microsoft.Win32.RegistryValueKind]::ExpandString)

And next try to connect to it again from WAC. Worked for me.