Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting VBScript's ScriptEngineMajorVersion Function

Windows PowerShell

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:


Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft