PSD1 Manifest file fails to load first

This topic contains 5 replies, has 2 voices, and was last updated by Profile photo of Dave Wyatt Dave Wyatt 1 year, 8 months ago.

  • Author
    Posts
  • #23549
    Profile photo of Bruce Williams
    Bruce Williams
    Participant

    Hello All

    I've created a new module and manifest powershell v4
    I understand how to put these together with the directoryName and psm1 & psd1 being all the same name, the module path being in the PSModulePath
    I also understand the load order of these (psd1 then psm1)

    The weird behavior I'm encountering is this:

    When I have the module in my local module path (in my MyDocuments\WindowsPowerShell\Modules\MyModule)
    I use import-module MyModule -verbose
    I see that the manifest is read first (psd1) then the module file (psm1), and things work as expected.
    Because some others will use this module I setup a network location (e.g. \\SERVER\Scripts\Modules\MyModule) place the files there
    and move the module directory to that folder, add the path to the PSModulePath.

    When I run 'import-module MyModule -verbose the psm1 file loads but not the psd1. Moving it back to my local directory and trying again, works as expected.

    Am I missing something ?

    Regards,

  • #23550
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    What happens if you run Test-ModuleManifest on the network path psd1 file?

  • #23551
    Profile photo of Bruce Williams
    Bruce Williams
    Participant

    I get the correct output, Odd indeed!

  • #23552
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Weird. I suppose you could try renaming the PSM1 file, so the only file which has a name matching the module directory is the manifest. Even if it doesn't work, it might shed some more light on what's going on.

  • #23553
    Profile photo of Bruce Williams
    Bruce Williams
    Participant

    Strangely it seems if the psd1 is on a dfs UNC path the manifest will not load?
    When I use the normal path it works ok, have you heard of this before?

  • #23554
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Well, I've heard of people having trouble with their execution policy (RemoteSigned) in conjunction with DFS paths. If you add the DNS name of the DFS path to the Local Intranet zone in IE, that generally clears it up.

    I haven't heard of module manifests failing to load under those circumstances, but it's still worth a try.

You must be logged in to reply to this topic.