Function to "Tool"

This topic contains 3 replies, has 4 voices, and was last updated by  Istvan Szarka 4 years ago.

  • Author
  • #15911

    Tracy Johnston

    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?


  • #15912

    Dave Wyatt

    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.)

  • #15952

    Istvan Szarka

    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.

  • #15914

    Martin Nielsen

    A network share works too.

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

You must be logged in to reply to this topic.