PSModulePath bug with WMF5?

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of David Jones David Jones 9 months, 1 week ago.

  • Author
    Posts
  • #36025
    Profile photo of Jeremy Murrah
    Jeremy Murrah
    Participant

    Wondering if anyone can reproduce this real quick, I think it's a bug or bug-like feature. with WMF5 installed, edit the PSModulepath system environment variable, and add a bogus network path on the end, something like "\\server\nopath". Then launch a new powershell session and see if basic functions like get-date, test-path and get-host all report that they aren't valid cmdlets.

    Also if you run get-module -listavailable the output doesn't include the location sorting, and many of the built-in modules have no exported commands. It's like powershell sort of strokes out and can't find the other half of its brain or something.

    Edit: I'm seeing this behavior on the WMF5 package for win7 and 2012R2, not sure if the windows 10 version is affected.

    Edit2: Worth noting that since DSC runs as SYSTEM, and SYSTEM cannot typically access network folders, even a valid network path in the PSModulePath breaks most DSC functions, as many rely on things like test-path, get-wmiobject, etc.

  • #36207
    Profile photo of David Jones
    David Jones
    Participant

    This issue is not just limited to WMF5. I just ran into it with WMF 4 on a fresh Hyper-V server 2012 R2 install. firmware update pooched the NIC and left me with an unreachable UNC path. this totally broke PowerShell

You must be logged in to reply to this topic.