Powershell: Check Version Before Running Script
If you create a PowerShell script and we say it must be version 3.0, you can simply add this to your script:
If ((Get-Host).Version.Major.Equals(3))
{
#Your script will run here.
}
Else
{
#You can add an error message here, so the user will understand, he/she doesn't have the actual version.
}
Remember, you can not use If ((Get-Host).Version.Major = "3") or something like that, because "Major" is a locked property.