Author Posts

February 28, 2018 at 9:35 pm

Powershell 5.1.16299.98 on Win10 1709.

I have two stock Win10 VM's, both with stock Powershell environments. (IOW, no profile, no installed modules, etc. I have done an initial Update-Help.)
One one of them, starting PS and immediately doing a Get-Module shows

PSReadline, 1.2

On the other, I only get two of the modules

PSReadline, 1.2

I've checked the C:\Program Files\WindowsPowerShell\Modules directory on both, and as near as I can tell, they look identical. Both machines have five directories:


Each of those directories has the single appropriate sub-directory underneath it corresponding to the version that shows up in get-module (on the first VM).

On the second VM where I only two are loaded automatically, I can do an "Import-Module PowershellGet" and it will load both it and the PackageManagement module. I can load Microsoft.Powershell.Management manually, or it shows automatically after I do a CD somewhere.

The question is why aren't those modules loading automatically in the second VM?
Is there a way to troubleshoot PS's startup, i.e. it's initial loading of the modules, what it does before presenting the first prompt to the user?
And, unrelated, but how does it know not to load Pester automatically?

March 14, 2018 at 6:46 pm

From a troubleshooting angle, I'd launch it with the noprofile switch as a start. I'd then load modules manually with -Verbose and see if anything interesting popped up. It's also worth comparing $PSVersionTable on them both.