Moving Powershell modules to local drive

Dave Gray 586 Reputation points
2021-04-19T11:50:40.18+00:00

Hello

I have my Azure Az PowerShell (PS) modules installed on a network share for some reason and this means that every time
I run anything it takes minutes whilst they are loaded.

I was therefore wondering if I could copy them to a local path and then setup a profile to use these.

$PROFILE | Get-Member -Type NoteProperty

89125-ps2.png

Though this seems not enough as either PS ISE or VS Code will continue to "look" in the network shares first.

So basically, what is the best way to have the Az.* modules locally and have PS always look to a local path?

Thanks

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2021-04-19T12:12:23.54+00:00

    Hi @Dave Gray ,

    could you please check the module path: $env:PSModulePath
    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psmodulepath?view=powershell-7.1

    Depending of the output a modification of the Module Path might help:
    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psmodulepath?view=powershell-7.1#modifying-psmodulepath

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


  2. Anonymous
    2021-04-21T03:56:11.943+00:00

    Hi,

    Please see if this works

    $env:PSModulePath = $env:PSModulePath.replace('\\domain.com\fileshare\Redirection$\david.gray\Documents\WindowsPowerShell\Modules;','')  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.