There is scripting expertise built-in to PowerShell v.2 that can be activated like this:
set-strictmode -version 1
set-strictmode -version 2
set-strictmode -version 2
Use the -version parameter to tell the cmdlet which PowerShell version rules you would like enforce. PowerShell will throw a lot of suggestions at you whenever you do something that violates the rules when you enter commands or run scripts in strict mode.