Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 995
Loïc MICHEL Avatar asked Dec 21 '22 20:12

Loïc MICHEL


1 Answers

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 }"
like image 196
Keith Hill Avatar answered Dec 30 '22 11:12

Keith Hill