Search code examples
powershellvbscriptjscript

How to find Microsoft JScript and VBScript engines versions through powershell


Is there any standard way to find the installed JScript and VBScript engines versions in a windows machine through Powershell commands or any other way around like by means of installed File version or any such way?


Solution

  • PS C:\> (get-item "c:\windows\system32\vbscript.dll").VersionInfo.FileVersion
    5.812.10240.16384
    PS C:\> (get-item "c:\windows\system32\jscript.dll").VersionInfo.FileVersion
    5.812.10240.16384
    

    Or, out of powershell, you can ask the engines.

    <?XML version="1.0" standalone="yes" encoding="utf-8" ?>
    <package>
    <job id="checkVersions" prompt="no">
    <?job error="true" debug="false" timeout="10" ?>
    <script id="checkVersionVBS" language="VBScript"><![CDATA[
        Call WScript.StdOut.WriteLine ( _ 
            Join(Array( _ 
                ScriptEngine, ScriptEngineMajorVersion, ScriptEngineMinorVersion, ScriptEngineBuildVersion _ 
            ), ".") _ 
        )
    ]]></script>
    <script id="checkVersionJS" language="JScript"><![CDATA[
        WScript.StdOut.WriteLine( [
            ScriptEngine(), ScriptEngineMajorVersion(), ScriptEngineMinorVersion(), ScriptEngineBuildVersion()
        ].join('.'));
    ]]></script>
    </job>
    </package>
    

    Saved as versions.wsf file and run as cscript //nologo versions.wsf you will get something like

    W:\>cscript //nologo versions.wsf
    VBScript.5.8.16384
    JScript.5.8.16384