Or, a list of
bestrecommended practices I try to follow.
Ah PowerShell… My favorite tool in the toolbox. One of the few tools that can do nearly everything, and make me look cool in the process.
Unfortunately I’ve been seeing quite a bit of hate and frustration from people on PowerShell. “It’s not a programming language”, “the formatting is horrible”, “It’s too forgiving”, etc.
Most of these frustrations stem from trying to pull apart code of other people. Quite honestly, I can find this task equally frustrating. Reading other peoples code is never fun. But it can be made easier if we all follow the same principles, taking in to account that most of us who use it are not “real” programmers (cause that’s not the group what PowerShell is aimed at!).
I’m going to try and lay out some of the things I try to do in my scripts and modules, and you’re free to comment, critisize, or suggest improvements. Together we can write “The Holy book of Powershell practices“!
HBoPS #1: Use a proper editor!
HBoPS #2: Error handling and you!
HBoPS #3: Avoid using Write-Host (and save puppies!)
HBoPS #4: Variables, Parameters, and Battlestar Galactica
HBoPS #5: Reduce, Reuse, Recycle
HBoPS #6: Handling Credentials