Prof. Powershell
5 Ways To Make PowerShell a Team Sport
My short list of suggestions for working with PowerShell in a team environment.
- By Jeffery Hicks
- 06/05/2012
Whenever I do a private PowerShell training class I like to spend a few minutes discussing next steps. Since generally in a private class the attendees all work together, I spend some time suggesting steps and ideas for working with PowerShell as a team. Here's my short list of collective decisions to make:
1. Agree upon a standard script template. Do you want some sort of standard header? What should go into it? A related decision is if the team what tool the team will use to develop PowerShell scripts. There's nothing wrong with the ISE but perhaps they are willing to invest in a commercial product.
2. Agree on a scripting style.
Do you want opening parentheses and braces at the end of a line or on their own line? What should be the tab and indent policy? These may seem like silly items, but if you are developing and sharing scripts in a team environment, consistency is very important.
3. Consider scripting policies.
What will be your company's script execution policy or policies? Can you set up and enforce script signing? Remember you only need a policy to allow script execution where you plan to run interactice scripts. If you are using scripts from your Windows 7 desktop to remotely manage your servers, you can leave the servers with a Restricted policy.
4. Consider using a source control system.
If you can find one that integrates easily into your scripting editor or IDE, so much the better. You need to be able to track who made what changes and roll them back if necessary.
5. If you are going to create functions and modules for internal and team use, put them on a network share and load them as necessary into your profile.
For example, I would create a single PS1 file will all the shared functions, say \\server01\admins\sharedfunctions.ps1. Then in each admin's profile all they need to do is dot source that script from the UNC. If functions change you only need to modify the single file. The team will get the changes the next time they start a PowerShell session.
My last bit of advice (okay, so it's now #6) is to encourage them to work together as a team to continue expanding their PowerShell knowledge. Perhaps having a Friday lunchtime session a few times a month where someone talks about something cool and PowerShell-related they came across, or perhaps forming a little scripting club. The worst thing you can do after sitting through a week of PowerShell training is not use it, so seek out ways where you have to use it and learn more about it.
PowerShell can be a team sport where everyone wins.
About the Author
Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.