As PowerShell v.2 becomes more common , you may want to check which PowerShell version a machine is running. Use this to differentiate between v.1 and higher versions from within PowerShell:
$isV2 = test-path variable:\psversiontable
Check this registry key if you need to determine the version from outside PowerShell:
Or take a look in our library and check out Alexander's comprehensive solution.