Some startup modules not loaded at startup

Welcome Forums General PowerShell Q&A Some startup modules not loaded at startup

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
8 months, 1 week ago.

  • Author
    Posts
  • #94828

    Participant
    Points: 1
    Rank: Member

    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

    Microsoft.Powershell.Management, 3.1.0.0
    Microsoft.Powershell.Utility, 3.1.0.0
    PackageManagement, 1.0.0.1
    PowerShellGet, 1.0.0.1
    PSReadline, 1.2
    

    On the other, I only get two of the modules

    Microsoft.Powershell.Utility, 3.1.0.0
    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:

    Microsoft.PowerShell.Operation.Validation
    PackageManagement
    Pester
    PowerShellGet
    PSReadline
    

    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?

  • #95972

    Keymaster
    Points: 1,638
    Helping HandTeam Member
    Rank: Community Hero

    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.

The topic ‘Some startup modules not loaded at startup’ is closed to new replies.