# If the $PSVersionTable variable doesn't exist, then you are running V1. # If it does exist, then the version will be available as $PSVersionTable.PSVersion. function Get-PSVersion { if (test-path variable:psversiontable) {$psversiontable.psversion} else {[version]"1.0.0.0"} }