Can You Help a Function Out?
I spend a lot of time writing about code, language, and syntax. But there is more to a professional-grade PowerShell script or function than pipelined expressions and logic. PowerShell script files will eventually need to be debugged, managed, or upgraded. And you might not be the person responsible. Even if you are, you want to make it easier for the “next person” to be able to manage your code. Don’t assume they will have your level of PowerShell expertise. The more you can do to ease the friction of managing your code, the better. This is one of the reasons the community is so adamant about avoiding aliases and using full cmdlet and parameter names. But that’s just the beginning.
I want to demonstrate a few things, and if you include some of them from the beginning of your script development, I think you’ll find the development process less error-prone.
Syntax Comments
Here’s the function we’ve been writing over the last several articles.