ScriptEngineMajorVersion


Definition: Returns the major version number of the scripting engine in use.

 

Determining the major version of Windows PowerShell itself is a snap: all you have to do is call the Get-Host Cmdlet and then grab the value of the Version.Major property. The following command determines the major version and then stores that value in the variable $a:

 

$a = (get-host).version.major

 

When you run this command and then echo back the value of $a you should get the following, depending on which version of PowerShell you are running:

 

1