PowerTip: Import a PowerShell Module from a Shared Location

PowerTip: Import a PowerShell Module from a Shared Location

  • Comments 4
  • Likes

Summary: Learn how to import a Windows PowerShell module from a shared location.

Hey, Scripting Guy! Question I have a module that will run on multiple servers, and I want to be able to access it from a single location. How can I import a Windows PowerShell module from a central location?

                             Hey, Scripting Guy! Answer Use the Import-Module cmdlet and specify the complete path to the folder containing the module. You can then use cmdlets from the module as if it were installed locally. 

                                                    Import-Module \\dc1\Share\PSWindowsUpdate

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Ooo... What if you created a module that updated all your modules from a central Server!

  • @Gene Laisne I believe you could do that ... it would be cool!

  • Not that easy though. What if your module has a dependency, say on another .NET library also sitting on a shared network?

  • @Sam  Fortunately that is not possible.  Net libraries must be installed locally.  They cannot reside on the network.  The PosH module file .psm1 can reside anywhere and can have depende4ncies on other modules.