VersionPS

This variable contains the Windows PowerShell version number from the target system as major.minor.build.revision; the build and revision parts may be absent. The installer sets this variable to the version of Windows PowerShell that is installed on the target system, if any. If Windows PowerShell is not present on the target system, this variable is empty.

Usage

You can refer to this variable as <VersionPS>. You can use the $vercmp function to compare the PowerShell version to something else, for example <$vercmp(<VersionPS>, 2.0>. The variable is set automatically by the installer.

You can compare version numbers directly using the standard relational operators < <= > >= = and <>, so a conditional expression like VersionPS < 2.0 will do a proper version comparison, obviating the need for the $vercmp function.

You can also use this variable to check for the presence of Windows PowerShell on the target system by using one of the following conditional expressions in the Condition field of an action or component:

Related topics

System information variables, PowerShell, Run Script