Author Posts

June 5, 2014 at 4:24 am

After listening to Don Jones at Teched I ran back to the office and created a few functions(with examples,help and no write-host"). I now want to give this function to people on other teams. What is the best way for me to deliver this. I do not want to load it in everyone's powershell profile. Is there a place I can store the PS1 that will auto pull it in for all users on a server?

Thanks

June 5, 2014 at 4:27 am

Ideally, you would place this function into a module (psm1 file), and place it in the module path for the server. (In PowerShell 4.0, the ideal place for this is "C:\Program Files\WindowsPowerShell\Modules" ). Then it becomes available for everyone to import as a module, and if running PowerShell 3.0 or later, module auto-loading will allow them to run it right away (without an import command first.)

June 5, 2014 at 6:55 am

A network share works too.


Import-Module \\server\share\module.psm1

June 5, 2014 at 12:35 pm

Or you could add a shared folder path to the PSModulePath environment variable and put your modules there. I guess you could do that with Group Policy or DSC. This way, you wouldn't have to put it into PowerShell's folder on every server.