Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Whats the best way to get consistent modules across our servers and workstations. To put it another way: I want to be able to write a powershell script and have it run on all machines meaning each machine will need the necessarily module imported.

Thanks

share|improve this question

2 Answers 2

The method we explored for handling this involved:

  1. A GPO policy to copy the modules to a consistent local location.
  2. The script specifically importing those modules from that consistent location.
  3. Set the execution policy so remote scripts can be run (unclear on details, it's just long enough ago I've forgotten the details).

We were getting this going at $OldJob but didn't go live in it before I left. So, take that as you will. However, the key thing is that you can't trust every default powershell instance to have the same modules so you have to specifically import them for each script you run, and powershell tends to complain if you try to import from non-local locations like on a central file-server somewhere.

share|improve this answer

I would recommend storing the modules in a centralized, network location. This is covered in detail here, but the main takeaways are as follows --

  • You can store PowerShell modules in a network location and import them the same as you would if they were local (i.e. Import-Module \\server\folder\MyModule.psm1)
  • You need to verify that your script execution policy is not set to Restricted. If you'd like to keep it set to Restricted, make sure you call your powershell session with the bypass parameter (i.e. powershell -executionpolicy bypass)
share|improve this answer
    
We have the script execution policy to all signed and each of the clients machines have the certificate. Ive had a read through and seams easy enough. JRJ comments at the bottom improves on the situation. Thanks –  resolver101 Apr 12 '12 at 10:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.