Manually load script module manifest when importing from outside PSModulePath.

Welcome Forums General PowerShell Q&A Manually load script module manifest when importing from outside PSModulePath.

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

 
Participant
2 years, 5 months ago.

  • Author
    Posts
  • #44479

    Participant
    Points: 1
    Rank: Member

    As I understand it, when importing a script module from a directory that is not included in $ENV:PSModulePath, the module manifest is bypassed. Is there a way I can Import-Module C:\temp\foo\foo.psm1 without ignoring C:\temp\foo\foo.psd1?

  • #44485

    Member
    Points: 0
    Rank: Member

    If you give Import-Module a full path to the psm1 file, then that's what gets imported. If you give it a path to a folder, then it'll search with the usual order (psd1 first).

    Import-Module C:\temp\foo
    
  • #44487

    Participant
    Points: 1
    Rank: Member

    Thanks Dave!

The topic ‘Manually load script module manifest when importing from outside PSModulePath.’ is closed to new replies.