module location

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Rob Simmers Rob Simmers 4 months, 4 weeks ago.

  • Author
    Posts
  • #65229
    Profile photo of PowerVsnake
    PowerVsnake
    Participant

    Hi Powershell Guru,

    I put my team module inside of 'C:\windows\system32\WindowsPowershell\v1.0\modules' directory. I heard that this directory is regard as 'holy site' for modules from Microsoft, not for 3rd party modules. The reason I put it there it is because I can remote to different server and use my team module from the remote server as long it is under the 'holy site'. If I put my modules elsewhere, I can't access them through remote server.

    I like to weight in the pros and cons to put 3rd party modules inside of the 'holy site'. Also, I would like to know another way to access my team module at remote server.

    thanks
    vsnake

  • #65235
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    There are multiple places that you can place a Module that Powershell will search by default. Below, you can see using $env:PSModulePath what the standard module paths are (outside of the first, which is obviously a dynamic user path):

    PS C:\Users\Rob> $env:PSModulePath -split ";"
    C:\Users\Rob\Documents\WindowsPowerShell\Modules
    C:\Program Files\WindowsPowerShell\Modules
    C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
    

    You could place the module in C:\Program Files\WindowsPowerShell\Modules or you can also specify a full path to the module as well:

    Import-Module -FullyQualifiedName C:\AdminTools\Powershell\Modules\MyModule
    
    • #65251
      Profile photo of PowerVsnake
      PowerVsnake
      Participant

      Thanks for posting, Rob.

      I wonder if I just leave my team module inside of C:\windows\system32\WindowsPowershell\v1.0\modules, will it do any harm?

  • #65341
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    I've put modules there in the past with no issues. Microsoft does place their modules there, but I've seen vendors\3rd party modules placed there as well.

You must be logged in to reply to this topic.