Appendix A. Windows PowerShell scripting best practices

One of the great things about Windows PowerShell 5.0 is that it is extremely flexible. This flexibility, however, comes at the cost of readability, complexity, and supportability. The best practices described in this appendix will help you minimize the effects of any of the potential pitfalls. Windows PowerShell is both a command-line environment and a scripting environment, and best practices for scripts are not always the best practices for interactive Windows PowerShell commands. The following best practices apply to the scripting environment.

General script construction

This section looks at some general considerations for the overall construction of scripts. This includes the use of ...

Get Windows PowerShell Step by Step, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.