PowerShell with a Purpose Blog

My 12 PowerShell Best Practices

Over the past few months, I've published a 12-part series of posts entitled "What To Do / Not To Do in PowerShell." These summarize my 12 major best practices for the shell, many of which are also enthusiastically endorsed by the broader PowerShell community. For your convenience, here they all are:

  1. Never use Write-Host
  2. Avoid $ErrorActionPreference
  3. Indent your code
  4. Spell out cmdlet and parameter names
  5. Don't use Hungarian notation
  6. Use multi-purpose "comments"
  7. Use mostly single quotes
  8. Use source control
  9. Use code signing
  10. Use cmdlet style naming
  11. Avoid the global scope
  12. Output objects
Enjoy!
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish