Please feel free to provide feedback or file bugs here.

Bug: Integrated Modules are not loaded if you have a Network Path in $env:PSModulePath which is not reachable

Integrated Modules are not loaded if you have a Network Path in $env:PSModulePath which is not reachable.

##############
I have customized the PSModulePath:

PS C:\Users\username> ($env:PSModulePath).split(';')
C:\Users\username\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
c:\Program Files\Microsoft Security Client\MpProvider\
C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell\
\\my.domain\share\Modules\

##############
If i try to execute e.g. Invoke-RestMethod

PS C:\Users\username> Invoke-RestMethod
Invoke-RestMethod : The 'Invoke-RestMethod' command was found in the module 'Microsoft.PowerShell.Utility', but the
module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Utility'.
At line:1 char:1
+ Invoke-RestMethod
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-RestMethod:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule


PS C:\Users\username> Get-Command Invoke-RestMethod
Get-Command : The term 'Invoke-RestMethod' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ Get-Command Invoke-RestMethod
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-RestMethod:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand


PS C:\Users\username> Import-Module Microsoft.PowerShell.Utility -Verbose
VERBOSE: Loading module from path
'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'.
Import-Module : The network path was not found
At line:1 char:1
+ Import-Module Microsoft.PowerShell.Utility -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.ImportModuleCommand

3 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Anonymous commented  ·   ·  Flag as inappropriate

        $PSVersionTable

        Name Value
        ---- -----
        PSVersion 5.1.14393.953
        PSEdition Desktop
        PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
        BuildVersion 10.0.14393.953
        CLRVersion 4.0.30319.42000
        WSManStackVersion 3.0
        PSRemotingProtocolVersion 2.3
        SerializationVersion 1.1.0.1

      Feedback and Knowledge Base