开发者

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


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 }"


Ok, for those who are interrested in here is the complete recipe :

1- On each your co-worker's workstation, modify the profile to dot source the common "profile"

-> . \\server\share\commonProfile.ps1

2- On the common profile, edit the PSModulePath and add your sharedFolder containing your modules (we test if the shared folder is allready in path)

    if($env:PSModulePath -match "\\\\server\\share\\modules" -eq $false){
    $env:PSModulePath = $env:PSModulePath + ";\\server\share\Modules"
}

3- Place the modules you create in \\server\share\Modules and import them from the commonProfile.

Optionaly :

  • Use SVN or so to keep your modules folder up-to-date

  • Use Redmine to track your developpements and bugs

  • Auto-generate docs to keep your co-workers aware of what you are doing ( i use a modified version of the Out-Html script found in poshcode.org

How to use a common powershell profile inside a team

Finally, Just Relax ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜