If you scan through code projects on PoshCode or the Microsoft Learn Code Samples Gallery, it will be immediately apparent that people in the PowerShell community have vastly different ideas about what's "right and wrong" in the world of PowerShell scripting.

Over the years several attempts have been made to arrive at a consensus, most notably the "Great Debate" series of blog posts on following the 2013 Scripting Games, which outlined some of the more controversial issues and asked for community discussions.

This project has been created, in part, as a public place to continue those debates as well as to document the consensus of the community when we do arrive at a consensus.

Remember that best practices are not hard-and-fast rules. We don't even consider them as solid as the Style Guide rules. They are the things you should usually do as a starting point, and should deviate from when it's appropriate.

One final note about these Best Practices: the perspective of these guidelines has so-far been strongly influenced by system administrator practitioners, less-so by language geeks and developers. We're trying to balance that and provide perspective, but when it comes to best practices, we definitely allow the experience of administrators to drive what the PowerShell community considers best and worst practices -- so if you are working from a different perspective, you'll have to take all of this with a grain of salt.

Table of Contents

Last updated