Microsoft KB Archive/309620

From BetaArchive Wiki
Knowledge Base


INFO: Detect Microsoft Virtual Machine by Using Script

Article ID: 309620

Article Last Modified on 10/20/2003



APPLIES TO

  • Microsoft virtual machine 31xx Series
  • Microsoft virtual machine 32xx Series
  • Microsoft virtual machine 33xx Series
  • Microsoft virtual machine 38xx Series
  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.01
  • Microsoft Internet Explorer 5.5
  • Microsoft Internet Explorer (Programming) 6.0



This article was previously published under Q309620

SUMMARY

Internet Explorer can detect product components and versions, including Microsoft virtual machine (Microsoft VM).

The code sample in this article demonstrates how to determine if Microsoft VM is installed and, if it is installed, the Microsoft VM version.

MORE INFORMATION

You can use the code sample in this section to detect Microsoft VM without invoking it. This code sample assumes that Internet Explorer is the browser. The code sample then determines if Microsoft VM is installed and if so, what the version number is. If Microsoft VM is not installed, or if the Microsoft VM version is outdated, you are redirected to the Microsoft VM installer page at http://windowsupdate.microsoft.com

<HTML xmlns:IE>
<HEAD>
<STYLE>
@media all {
     IE\:clientCaps {behavior:url(#default#clientcaps)}
}
</STYLE>
</HEAD>
<BODY>

<IE:clientCaps ID="oClientCaps" />
<SCRIPT Language="JScript">

    if ( "Microsoft Internet Explorer" == navigator.appName )
    {   //Running in Internet Explorer.

        if ( (sMSvmVersion = oClientCaps.getComponentVersion("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}", "ComponentID") ) )
        {   //Microsoft VM is present.

            if ( "5,0,3802,0" == sMSvmVersion )
            {   //The current version of Microsoft VM is installed; no action is needed.

                document.write ("The most recent version of Microsoft VM is installed on this computer.");
                //Redirect to the working page.
            } else
            {   //An older version of Microsoft VM is installed. Redirect for update.

                document.write("The most recent version of Microsoft VM is not installed on this computer.<BR>");
                versionText();
                window.setTimeout ( "redirector()", 10000 );
            }

        } else
        {   //Microsoft VM is not present.

            document.write("Microsoft VM is not installed on this computer.<BR>");
            versionText();
            window.setTimeout( "redirector()", 10000 );
        }
    } else {
        //Not running in Internet Explorer.
        document.write("This browswer is " + window.navigator.appName + "<BR>" );
        document.write("Microsoft VM is not available for this product.");
    }


function redirector()
{
    window.open ("http://windowsupdate.microsoft.com");
}

function versionText()
{
    if ( navigator.userAgent.indexOf("Windows NT 5.1") >  -1 )
    {   //Running on Windows XP. Will be redirected to Windows Update version 4.

        document.write("A second browser window will open to <A HREF='http://windowsupdate.microsoft.com'>http://windowsupdate.microsoft.com</A> in 10 seconds.<BR><BR>");
        document.write("<OL>");
        document.write("<LI>Choose 'Scan for Updates'. This will take a few seconds to complete.</LI>");
        document.write("<LI>The latest Microsoft VM is installed by the 'Security Update, August 2, 2001' in the 'Critical Updates' section.</LI>");
        document.write("<LI>Click 'Review and install updates'.</LI>");
        document.write("<LI>Click 'Install Now'.</LI>");
        document.write("<LI>After you review the License Agreement, click 'Accept'.</LI>");
        document.write("</OL>");
        document.write("<BR>Please reference Microsoft Knowledge Base article Q306525 to configure Windows XP to automatically look for product updates.<BR>To review this article, type 'MSKB Q306525' in the Address bar of Internet Explorer.<BR>");
    } else
    {   //Not Running on Windows XP, will be redirected to standard Windows Update

        document.write("A second browser window will open to <A HREF='http://windowsupdate.microsoft.com'>http://windowsupdate.microsoft.com</A> in 10 seconds.<BR><BR>");
        document.write("<OL>");
        document.write("<LI>Please click 'Product Updates' on the left side of the window.</LI>");
        document.write("<LI>If you are prompted to install Microsoft Windows Update Active Setup, click 'Yes'.</LI>");
        document.write("<LI>When this completes, one or more updates will be available.</LI>");
        document.write("<LI>Scroll down and then select 'Security Update, August 2,2001'.</LI>");
        document.write("<LI>Click 'Download' at the top of the page.</LI>");
        document.write("<LI>Click 'Start Download' to review your selection.</LI>");
        document.write("<LI>Click 'Yes' after you review the License Agreement.</LI>");
        document.write("</OL>");
    }
}


</SCRIPT>
</BODY>
</HTML> 
                

Keywords: kbinfo KB309620