Best practices
We have covered many aspects of PowerShell scripting in the preceding chapters, and while doing so we wrote many examples. The majority of these examples were a few lines or blocks of script, but the main aim of these examples was to showcase the feature or functionality that I was explaining. So I tried to use very simple examples without much fuss about best practices. These scripts probably did not conform to the guidelines, but that was intentional as I wanted you to focus on the example, script, and cmdlet itself and not get distracted by the other best practices. In this section, we are going to talk about the best practices that you should follow while writing scripts for yourself or for others.
If you want to script like a pro, then it is necessary to follow these best practices. Many do not consider scripting to be serious coding, but believe it or not scripting is a serious business. You can achieve the same results as applications written in professional programming...