Powershell Day 30

Day 30 Best Practice

Having good Security is first best practice for any language no exception with Powershell. Having that we should also we try to follow following best practices.

*Best practice is not always best. It may vary depends on our requirement. And good for one may not be good for others.

  1. Follow standard coding format
  2. Document everything
  3. Test everything completely before implementing on production environment.
  4. Maintain versioning of the code –VSS
  5. Use Write-Debug or Write-Verbose
  6. Use Write-host and write-output
  7. Do not run the script if you don’t know the logic/result.
  8. Maintain security standard try to use allsigned security policy if possible.
  9. Consider Day 29 – securing your data. Like SecureString, certificates, etc.
  10. Cleanup stuff after you have done. Means drop the object(s) once you are done with it.
  11. Plan first before start, then design finally implement keep the system optimize.
  12. Avoid Shortcuts :try to use fully qualified pathnames.
  13. Try to use cmdlets for most.

Below is the link by scripting guy blog where he describe the parameter alias which are not documented (only cmdlet alias are )


Great book by ScriptingGuy(Ed Wilson) “Powershell Best Practice” and webcast about Best Practice:


It was a wonderful journey of 30 days – I enjoyed each and everyday. every day was a new day and gives me something new.



This entry was posted in Powershell and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.