Search code examples
powershellprofilecollaboration

How to use a common powershell profile inside a team


I would like to know how to share and keep up-to-date a profile ($profile.AllUsersAllHosts) beetween all my co-workers. As i am the only one who make POSH scripts in the team, i'd like to create a sort of framework providing the distribute it to team members.

Is there a way to load profile from an url ? Or should i use the local profil to map a network drive, then load the .ps1 file ? Other ideas ?

Thank you


Solution

  • Rather than fight the system, I suggest you keep your common profile on a network then have folks dot source that profile within the profile on the machine (either user or machine profile):

    . \\server\share\CommonProfile.ps1
    

    Another option is to create a shortcut to PowerShell.exe with the -NoExit parameter that executes the common profile e.g.

    PowerShell.exe -NoExit -Command "& {. \\server\share\CommonProfile.ps1 }"