Saturday, December 03, 2005

Detect installed MSXML version

MSXML version check can be done with the help of online MSXML version sniffer, which works from within IE. See this link for example. Unfortunately, it does not tell you the exact version of MSXML with service pack installed. If you need service pack info - you may use the following information from Microsoft and the script below.

----- msxml_detect_versions.js ---
// display versions of msxml .dll files

var fso = new ActiveXObject("Scripting.FileSystemObject");
var WindowsFolder = 0 , SystemFolder = 1, TemporaryFolder = 2;
var system32 = fso.GetSpecialFolder(SystemFolder);

function ReportSystem32File(filename)
{
var s = filename;
var system32file = fso.BuildPath(system32, filename);
if (fso.FileExists(system32file))
s += " \tversion\t " + fso.GetFileVersion(system32file);
else
s += " \tdoes not exist";
return(s);
}

WScript.Echo(
ReportSystem32File("msxml.dll") + "\n" +
ReportSystem32File("msxml2.dll") + "\n" +
ReportSystem32File("msxml3.dll") + "\n" +
ReportSystem32File("msxml4.dll") + "\n" +
ReportSystem32File("msxml5.dll") + "\n" +
ReportSystem32File("msxml6.dll") + "\n" +
"\n" + "For information about versions of MS XML parser " +
"\n" + "corresponding to above file version numbers see " +
"\n" + "http://support.microsoft.com/kb/269238/EN-US/"
);
// techtonik//php.net $Date$
----- msxml_detect_versions.js ---