What's Inside
If you are administering (or somehow related to) any kind of network, you may wish to periodically acquire a more-or-less complete image of what's happening in your PCs. The presented script was created to ease the task of keeping track of hardware and software components throughout the enterprise; it queries all the WMI classes that I think are useful to monitor. The script was designed to accomplish the following goals:
- collect information about crucial characteristics of a selected computer(s)
- maximize interoperability, that results in serializing the collected data to XML
- provide an extensible framework for building administrative tools upon WMI services
This article is in no way a tutorial on WMI; it just explains what the accompanying tool is and how it works. Using the tool doesn't require anything beyond the basic knowledge of Windows Management Instrumentation; understanding and extending the tool requires a programming experience with Windows Scripting Host, JScript language and Microsoft XML library.
Frontend
The common way of using the tool is through the wmi_admin.hta page. UI is fairly obvious.
- First tab allows you to type in the IPs or IP ranges you want to query.
- On the second tab you can select what info will be gathered. There q plenty of options to choose from.
- Third tab can be used to enter administrator's options.
- On the last tab you'll press the "Run query" button and will see the tests running.
Doing It the Hard Way
Script (scripts/wmiadmin.js) can be also run from the command line.
- Starting it all
You can run the script by running the wmiadmin.js file. Shell command:
[cscript] wmiadmin.js
collects info on the local computer and opens the resulting XML file (named result-127-0-0-1.xml) in a browser; and
[cscript] wmiadmin.js xxx.xxx.xxx.xxx
collects info about the computer whose IP address is xxx.xxx.xxx.xxx
, creates the resulting XML file named result-xxx-xxx-xxx-xxx.xml and opens it in a browser. You can specify any number of IP addresses as you wish:
[cscript] wmiadmin.js xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy zzz.zzz.zzz.zzz
creates result-xxx-xxx-xxx-xxx.xml, result-yyy-yyy-yyy-yyy.xml, result-zzz-zzz-zzz-zzz.xml files and opens them in a browser.
Specifying /silent
key runs the script in a 'silent mode':
[cscript] wmiadmin.js /silent
collects info about the local computer and doesn't show the resulting XML file;
[cscript] wmiadmin.js /silent xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
collects info about the computers with IPs xxx.xxx.xxx.xxx
and yyy.yyy.yyy.yyy
, and doesn't show the resulting XML files.
Specifying /username:name
and /password:pass
gives you a chance to use alternative credentials instead of those provided by the system:
[cscript] wmiadmin.js /username:alice /password:anywordyoulike
xxx.xxx.xxx.xxx
collects info about the computer with IP xxx.xxx.xxx.xxx
using username alice and password anywordyoulike and shows the resulting XML file.
/domain
and /auth
keys allow you to specify the target domain and the way you authenticate on this domain. If this key value is equal to "kerberos", Kerberos authentication is used; otherwise, NTLM authentication is used:
[cscript] wmiadmin.js /domain:acme /username:alice
/password:anywordyoulike /auth:kerberos xxx.xxx.xxx.xxx
- Collecting data
The process of gathering system info consists of:
- WMI connection setup:
this._SetupService = function(ip)
{
if(!this._service[ip])
{
var locator = new ActiveXObject("WbemScripting.SWbemLocator");
this._service[ip] = locator.ConnectServer(ip, "root\\cimv2",
this._username, this._password, "",
this._domain ?
(this._kerberos ? ("kerberos:" + this._domain) :
("NTLMDOMAIN:" + this._domain)) : "");
this._service[ip].Security_.ImpersonationLevel = 3;
}
this._curserv = this._service[ip];
}
- Actual query. All the WMI queries are made through
_ExecQuery
or _ExecQueryWithWhereClause
methods of WMIcollector
object:
this._ExecQuery = function(className)
{
return this._curserv.InstancesOf(className);
}
this._ExecQueryWithWhereClause = function(className, condition)
{
return this._curserv.ExecQuery("Select * from " + className +
" Where " + condition);
}
The following is one of the many query routines:
this._collect1394ControllerInfo = function()
{
var fc = new Enumerator(runQuery("Win32_1394Controller"));
var xmlDoc = null, colItem = null, numItems = 0;
for (; !fc.atEnd(); fc.moveNext())
numItems++;
if(numItems > 0)
{
xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
if(numItems > 1)
{
colItem = xmlDoc.createElement("Item");
xmlDoc.appendChild(colItem);
this._xmlSetAttribute(xmlDoc, colItem, "name",
"IEEE 1394 Controllers");
}
var i = 1;
for (fc.moveFirst(); !fc.atEnd(); fc.moveNext())
{
var Obj = fc.item();
var root, num = "";
if(colItem != null)
{
root = xmlDoc.createElement("Element");
num = " " + String(i);
}
else
{
root = xmlDoc.createElement("Item");
}
this._xmlSetAttribute(xmlDoc, root, "name",
"IEEE 1394 Controller" + num);
if(colItem != null)
{
colItem.appendChild(root);
}
else
{
xmlDoc.appendChild(root);
}
this._xmlCreateChildTextNode(xmlDoc, root, "Availability",
translate_availability(Obj.Availability));
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, root,
"DeviceID", Obj.DeviceID, "name", "Device ID");
this._xmlCreateChildTextNode(xmlDoc, root,
"Manufacturer", Obj.Manufacturer);
this._xmlCreateChildTextNode(xmlDoc, root, "Name", Obj.Name);
this._xmlCreateChildTextNode(xmlDoc, root, "Status",
Obj.Status);
i++;
}
}
return xmlDoc;
}
- Building the XML Tree
Five helper functions - a thin wrapper to Microsoft XML parser - are used. Common parameters are:
doc
- an object of type Msxml2.DOMDocument
parent
, node
- object(s) of type IXMLDOMElement
nodeName
, attributeName
- character strings that are suitable as node/attribute names attributeValue
, nodeContent
- any character string
this._xmlSetAttribute = function(doc, node, attributeName,
attributeValue)
{
var Attribute = doc.createAttribute(attributeName);
var AttributeText = doc.createTextNode(this._trim(attributeValue));
Attribute.appendChild(AttributeText);
node.setAttributeNode(Attribute);
}
this._xmlCreateChildNode = function(doc, parent, nodeName)
{
var Element = doc.createElement(nodeName);
parent.appendChild(Element);
return Element;
}
this._xmlCreateChildNodeWithAttribute = function(doc, parent,
nodeName, attributeName, attributeValue)
{
var Element = doc.createElement(nodeName);
parent.appendChild(Element);
this._xmlSetAttribute(doc, Element, attributeName, attributeValue);
return Element;
}
this._xmlCreateChildTextNode = function(doc, parent, nodeName,
nodeContent)
{
var str = this._trim(String(nodeContent));
if(this._isempty(str)) return null;
var Element = doc.createElement(nodeName);
var ElementText = doc.createTextNode(str);
parent.appendChild(Element);
Element.appendChild(ElementText);
return Element;
}
this._xmlCreateChildTextNodeWithAttribute = function(doc, parent,
nodeName, nodeContent, attributeName, attributeValue)
{
var str = this._trim(String(nodeContent));
if(this._isempty(str)) return null;
var Element = doc.createElement(nodeName);
var ElementText = doc.createTextNode(str);
parent.appendChild(Element);
Element.appendChild(ElementText);
this._xmlSetAttribute(doc, Element, attributeName, attributeValue);
return Element;
}
The resulting XML tree has the following structure:
<Root>
<Metadata>
<IP> - IP address queried
<Date> - Date (local) when the query was run
<Time> - Time (local) when the query was run
<Hardware>
<Item name="item name"> -
in case of a single item under a category
<characteristic1 name="characteristic1 name">
...
<characteristicN name="characteristicN name">
...
<Item name="item collection name"> -
in case of several items under one category
<Element name="name of a distinct item">
<characteristic1 name="characteristic1 name">
...
<characteristicN name="characteristicN name">
...
...
<Software> - the same substructure as in <Hardware>
...
- Gathering the Result
The RunQuery
method of WMIcollector
object is, actually, the main function of the script:
this.RunQuery = function()
{
for(var i = 0; i < this._ip.length; i++)
{
var cur_ip = this._ip[i];
this._xml[cur_ip] = this._collectAll(cur_ip);
}
}
_collectAll
, in turn, calls all the info-collecting functions.
- Viewing the Result
The script flow can be described as:
- construct an output file name from the IP address (xxx.xxx.xxx.xxx) in the format: result-xxx-xxx-xxx-xxx.xml, where xxx are the parts of the given IP address
- gather info
- write the collected info (in the form of XML tree) to the output file
- programmatically open the newly created file in a browser (only if not in the silent mode)
All of the above (except 2nd item) is done outside of WMICollector
object:
if(typeof(WScript) == "object")
{
var local_ip = "127.0.0.1";
var wmic = null;
var Args = WScript.Arguments;
if(!Args.length)
{
wmic = new WMIcollector(local_ip);
}
else
{
var ArgsNamed = Args.Named, ArgsUnnamed = Args.Unnamed;
var username = ArgsNamed.Exists("username") ?
ArgsNamed.Item("username") : null;
var password = ArgsNamed.Exists("password") ?
ArgsNamed.Item("password") : null;
var domain = ArgsNamed.Exists("domain") ?
ArgsNamed.Item("domain") : null;
var silent = ArgsNamed.Exists("silent");
var secure = ArgsNamed.Exists("auth") ?
(ArgsNamed.Item("auth") == "kerberos") : false;
var ips = [];
for(var i = 0; i < ArgsUnnamed.length; i++)
ips[ips.length] = ArgsUnnamed(i);
if(!ips.length) ips[0] = local_ip;
wmic = new WMIcollector(ips, username, password, domain, secure);
}
wmic.RunQuery();
var fso = new ActiveXObject("Scripting.FileSystemObject");
var writer = new ActiveXObject("Msxml2.MXXMLWriter.3.0");
writer.indent = true;
writer.omitXMLDeclaration = true;
var reader = new ActiveXObject("Msxml2.SAXXMLReader.3.0");
reader.contentHandler = writer;
reader.errorHandler = writer;
for(ip in wmic._xml)
{
var fname = "result-" + String(ip).replace(/\./g, "-") + ".xml";
var xmlFile = fso.CreateTextFile(fname, true, true);
var encoding = "UTF-16";
reader.parse(wmic._xml[ip]);
xmlFile.WriteLine("<?xml version=\"1.0\" encoding=\"" +
encoding + "\"?>");
xmlFile.WriteLine("<?xml-stylesheet type=\"text/xsl\"
href=\"wmiadmin.xsl\"?>");
xmlFile.Write(writer.output);
?><?xml-stylesheet type=\"text/xsl\"
// href=\"wmiadmin.xsl\"?>" + result.xml);
xmlFile.Close();
if(!silent)
{
var Path = WScript.ScriptFullName;
Path = Path.substring(0, Path.lastIndexOf("\\"));
// To view using MS IE:
var ie = new ActiveXObject("InternetExplorer.Application");
ie.visible = true;
ie.navigate("file://" + Path + "/" + fname);
// To view the file in your default browser:
/* var shl = new ActiveXObject("WScript.Shell");
shl.Run(fname); */
}
}
}
- Sample Stylesheet
One more thing to look at is the wmiadmin.xsl file (included in the accompanying archive). This rather straightforward XSLT stylesheet is an example of how you can convert the resulting XML tree to a more readable form.
Gotchas
There are several pitfalls you must be aware of:
- Pinging
A PC's availability can be checked by pinging the target computer through Win32_PingStatus
. However, this class is only accessible in Windows XP / Windows 2003 Server (or later). Under other versions of Windows, you must explicitly call the ping
utility and analyze its output:
function Ping(ip)
{
if(ip == "") ip = "127.0.0.1";
var oShell = new ActiveXObject("WScript.Shell");
var oScriptExec = oShell.Exec("ping -n 2 -w 1000 " + ip);
var strPingResults = oScriptExec.StdOut.ReadAll();
strPingResults.toLowerCase();
if(strPingResults.indexOf("reply from") != -1)
{
if(strPingResults.indexOf("destination net unreachable") != -1)
{
return (ip + "did not respond to ping.");
}
else
{
return (ip + " responded to ping.");
}
}
else
return (ip + " did not respond to ping.");
}
- Property Arrays
All the arrays that WMI provides are VB-safearrays and cannot be indexed directly. Use the Enumerator object:
if(Obj.BiosCharacteristics != null)
{
var char_node = this._xmlCreateChildNodeWithAttribute(xmlDoc, root,
"BIOSCharacteristics", "name", "BIOS Features");
var i_count = 1;
var chars_ar = Obj.BiosCharacteristics.toArray();
var chars_en = new Enumerator(chars_ar);
for (; !chars_en.atEnd(); chars_en.moveNext())
{
var ch_obj = chars_en.item();
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, char_node,
"Characteristic_" + String(i_count),
translate_bios_feats(ch_obj), "name",
"Feature " + String(i_count));
i_count++;
}
}
- Attribute Bitmaps
A very special case of property is the "attribute bitmap", which contains a merger (produced by logical OR) of several distinct values. These values can be extracted by testing the bitmap (with the logical AND) against every possible value that it can contain:
var attrib_node =
this._xmlCreateChildNode(xmlDoc, root, "Attributes");
if(Obj.Attributes & 0x1)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute1", "true", "name",
"Print jobs are buffered and queued");
if(Obj.Attributes & 0x2)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute2", "true", "name",
"Document to be sent directly to the printer");
if(Obj.Attributes & 0x4)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute3", "true", "name",
"Default printer on a computer");
if(Obj.Attributes & 0x8)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute4", "true", "name",
"Available as a shared network resource");
if(Obj.Attributes & 0x10)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute5", "true", "name",
"Attached to a network");
if(Obj.Attributes & 0x20)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute6", "true", "name",
"Hidden from some users on the network");
if(Obj.Attributes & 0x40)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute7", "true", "name",
"Directly connected to a computer");
if(Obj.Attributes & 0x80)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute8", "true", "name",
"Enable the queue on the printer if available");
if(Obj.Attributes & 0x100)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute9", "true", "name",
"Spooler should not delete" +
" documents after they are printed");
if(Obj.Attributes & 0x200)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute10", "true", "name",
"Start jobs that are finished spooling first");
if(Obj.Attributes & 0x400)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc,
attrib_node, "Attribute11", "true", "name",
"Queue print jobs when a printer is not available");
if(Obj.Attributes & 0x800)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute12", "true", "name",
"Enable bi-directional printing");
if(Obj.Attributes & 0x1000)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute13", "true", "name",
"Allow only raw data type jobs to be spooled");
if(Obj.Attributes & 0x2000)
this._xmlCreateChildTextNodeWithAttribute(xmlDoc, attrib_node,
"Attribute14", "true", "name",
"Published in the network directory service");
- Uint-to-string Translations
Many properties are of the type integer
. To convert any of these uint
s to readable form, you must write a translation function like this:
this._translate_availability(code)
{
if(this._isempty(code)) return "";
switch(code)
{
case 1: return "Other"; break;
case 3: return "Running / Full Power"; break;
case 4: return "Warning"; break;
case 5: return "In Test"; break;
case 6: return "Not Applicable"; break;
case 7: return "Power Off"; break;
case 8: return "Off Line"; break;
case 9: return "Off Duty"; break;
case 10: return "Degraded"; break;
case 11: return "Not Installed"; break;
case 12: return "Install Error"; break;
case 13: return "Power Save - Unknown"; break;
case 14: return "Power Save - Low Power Mode"; break;
case 15: return "Power Save - Standby"; break;
case 16: return "Power Cycle"; break;
case 17: return "Power Save - Warning"; break;
default: return "Unknown"; break;
}
}
Functions have been written for (almost) every 'translatable' property. If you notice something uncovered, please let me know.
- Correct XML Encoding
This problem falls into two parts:
- Creating a file with correct encoding (ASCII or Unicode)
- Specifying the encoding for XML tree
Both tasks are performed by two lines of code in the RunQuery
method:
this.RunQuery = function()
{
...
var xmlFile = fso.CreateTextFile(fname, true, true);
var encoding = "UTF-16";
...
}
Joining Unicode-type file and UTF-16 XML tree together is the universal method for delivering compatible XML files. However, if you are absolutely sure that computers you query return nothing that falls out of an ordinary ASCII charset, you may wish to switch back to saving single-byte data (by switching the last parameter of 'CreateTextFile
' to 'false
' and changing the 'encoding
' variable to 'UTF-8
', 'iso-8859-1
', or any other charset that fits your locale), thus saving 50% of the disk space.
- Neat vs. Raw
For production (or just aesthetic) purposes, it may be useful to write XML tree in a 'neat', i.e. indented style. This is done by using SAXXMLReader
and MXXMLWriter
objects:
this.RunQuery = function()
{
...
var writer = new ActiveXObject("Msxml2.MXXMLWriter.3.0");
writer.indent = true;
writer.omitXMLDeclaration = true;
var reader = new ActiveXObject("Msxml2.SAXXMLReader.3.0");
reader.contentHandler = writer;
reader.errorHandler = writer;
...
var result = this._collectAll(cur_ip);
reader.parse(result.xml);
xmlFile.WriteLine("<?xml version=\"1.0\" encoding=\"" + encoding);
xmlFile.WriteLine("\"?>");
xmlFile.WriteLine("<?xml-stylesheet type=\"text/xsl\" ");
xmlFile.WriteLine("href=\"wmiadmin.xsl\"?>");
xmlFile.Write(writer.output);
xmlFile.Close();
...
}
Nevertheless, you can always switch to a simpler (== faster) method of writing a single-line file (which will save you ~7-10% of the disk space):
...
xmlFile.Write("<?xml version=\"1.0\" encoding=\"" + encoding +
"\"?><?xml-stylesheet type=\"text/xsl\" href=\"wmiadmin.xsl\"?>" +
result.xml);
xmlFile.Close();
...
Achieved Milestones
Time has come to review the results and think of the future.
- The list of WMI classes and properties has been assembled, and the appropriate code has been set up
- WMI setup and query procedures have been created
- XML tree construction and serialization procedures have been created
- Several options (silent mode, multiple IPs) installed, with all major problems addressed (including internationalization and Unicode interoperability issues)
- UI is up and running
Evolution of wmiadmin tool is not finished. Feel free to write to me all your opinions and suggestions, bugs you've faced and features you'd like to see.
Hardware Classes
Motherboard, Controllers, and On-board Devices
Win32_1394Controller
uint16 Availability
; string DeviceID
; string Manufacturer
; string Name
; string Status
;
Win32_BaseBoard
string Manufacturer
; string Model
; string Name
; string Product
; string Status
; string Version
;
Win32_BIOS
uint16 BiosCharacteristics[]
; string IdentificationCode
; string Manufacturer
; string Name
; datetime ReleaseDate
; string Status
; string Version
;
Win32_InfraredDevice
uint16 Availability
; string DeviceID
; string Manufacturer
; string Name
; string Status
;
Win32_ParallelPort
uint16 Availability
; string DeviceID
; string Name
; string Status
;
Win32_PCMCIAController
uint16 Availability
; string DeviceID
; string Manufacturer
; string Name
; string Status
;
Win32_PhysicalMemory
string BankLabel
; uint64 Capacity
; uint16 FormFactor
; boolean HotSwappable
; string Manufacturer
; uint16 MemoryType
; string Model
; string Name
; string SerialNumber
; uint32 Speed
;
Win32_PortConnector
string InternalReferenceDesignator
; string Name
; boolean PoweredOn
; string Status
;
Win32_Processor
uint16 Architecture
; uint16 Availability
; string Caption
; uint16 CpuStatus
; uint32 CurrentClockSpeed
; uint16 CurrentVoltage
; string DeviceID
; uint16 Family
; string Manufacturer
; uint32 MaxClockSpeed
; string Name
; string ProcessorId
; uint16 ProcessorType
; uint16 Revision
; string Role
; string SocketDesignation
; string Status
; string Version
;
Win32_IDEController
uint16 Availability
; string Caption
; string DeviceID
; string Manufacturer
; uint64 MaxNumberControlled
; string Name
; uint16 ProtocolSupported
; string Status
;
Win32_SCSIController
uint16 Availability
; string Caption
; string DeviceID
; string DriverName
; string HardwareVersion
; string Manufacturer
; uint64 MaxTransferRate
; string Name
; uint16 ProtectionManagement
; uint16 ProtocolSupported
; string Status
;
Win32_SerialPort
uint16 Availability
; string DeviceID
; uint32 MaxBaudRate
; string Name
; uint16 ProtocolSupported
; string ProviderType
; string Status
;
Win32_SoundDevice
uint16 Availability
; string Caption
; string DeviceID
; string Manufacturer
; string ProductName
; string Status
;
Win32_USBController
uint16 Availability
; string Caption
; string DeviceID
; string Manufacturer
; string Name
; string Status
;
Video Devices
Win32_DesktopMonitor
uint16 Availability
; string DeviceID
; uint16 DisplayType
; string MonitorManufacturer
; string MonitorType
; string Name
; uint32 PixelsPerXLogicalInch
; uint32 PixelsPerYLogicalInch
; uint32 ScreenHeight
; uint32 ScreenWidth
; string Status
;
Win32_VideoController
string AdapterDACType
; uint32 AdapterRAM
; uint16 Availability
; uint32 CurrentRefreshRate
; string Description
; string DeviceID
; datetime DriverDate
; string DriverVersion
; uint32 MaxRefreshRate
; uint32 MinRefreshRate
; boolean Monochrome
; string Name
; uint16 ProtocolSupported
; string Status
; uint16 VideoArchitecture
; uint16 VideoMemoryType
; string VideoModeDescription
; string VideoProcessor
;
Mass Storage Devices
Win32_CDROMDrive
uint16 Availability
; string DeviceID
; string Drive
; boolean DriveIntegrity
; string Manufacturer
; uint64 MaxMediaSize
; string MediaType
; string Name
; uint64 Size
; string Status
;
Win32_DiskDrive
uint16 Availability
; string DeviceID
; string Drive
; boolean DriveIntegrity
; string Manufacturer
; uint64 MaxMediaSize
; string MediaType
; string Name
; uint64 Size
; string Status
;
Win32_FloppyDrive
uint16 Availability
; string DeviceID
; string Name
; string Status
;
Win32_TapeDrive
uint16 Availability
; uint16 Capabilities[]
; uint32 Compression
; string CompressionMethod
; string DeviceID
; uint32 ECC
; string ErrorMethodology
; uint32 FeaturesHigh
; uint32 FeaturesLow
; string Id
; string Manufacturer
; uint64 MaxMediaSize
; string MediaType
; uint32 NumberOfMediaSupported
; string PNPDeviceID
; uint32 ReportSetMarks
; string Status
;
Input Devices
Win32_Keyboard
uint16 Availability
; string DeviceID
; string Layout
; string Name
; uint16 NumberOfFunctionKeys
; string Status
;
Win32_PointingDevice
uint16 Availability
; string DeviceID
; uint16 DeviceInterface
; string HardwareType
; string Manufacturer
; string Name
; uint8 NumberOfButtons
; uint16 PointingType
; uint32 Resolution
; uint32 SampleRate
; string Status
;
Networking Devices
Printer Devices
Power Supply Devices
Cooling Devices
Win32_Fan
boolean ActiveCooling
; uint16 Availability
; string DeviceID
; string Name
; string PNPDeviceID
; string Status
; boolean VariableSpeed
;
Win32_HeatPipe
boolean ActiveCooling
; uint16 Availability
; string DeviceID
; string Name
; string PNPDeviceID
; string Status
;
Win32_Refrigeration
boolean ActiveCooling
; uint16 Availability
; string DeviceID
; string Name
; string PNPDeviceID
; string Status
;
System Enclosure
Win32_SystemEnclosure
boolean AudibleAlarm
; string CableManagementStrategy
; uint16 ChassisTypes[]
; uint16 HeatGeneration
; boolean LockPresent
; string Manufacturer
; string Model
; string Name
; uint16 NumberOfPowerCords
; uint16 ServicePhilosophy[]
; string Status
; string Tag
; boolean VisibleAlarm
;
Software Classes
Operating System Settings
Win32_ComputerSystem
string BootupStatev
; string Caption
; string Domain
; uint16 DomainRole
; boolean InfraredSupported
; string Manufacturer
; string Model
; string Name
; uint32 NumberOfProcessors
; boolean PowerManagementSupported
; uint16 PowerState
; uint16 PowerSupplyState
; string Status
; string SystemType
; uint16 ThermalState
; uint64 TotalPhysicalMemory
; string UserName
; uint16 WakeUpType
;
Win32_OperatingSystem
string BootDevice
; string BuildNumber
; string BuildType
; string Caption
; string CodeSet
; string CountryCode
; sint16 CurrentTimeZone
; boolean Distributed
; uint8 ForegroundApplicationBoost
; uint64 FreePhysicalMemoryv
; uint64 FreeVirtualMemory
; datetime LastBootUpTime
; datetime LocalDateTime
; string Locale
; string Manufacturer
; uint32 MaxNumberOfProcesses
; string Name
; uint32 NumberOfProcesses
; uint32 NumberOfUsers
; string Organization
; uint32 OSLanguage
; uint32 OSProductSuite
; uint16 OSType
; string RegisteredUser
; string SerialNumber
; uint16 ServicePackMajorVersion
; uint16 ServicePackMinorVersion
; string Status
; string SystemDevice
; string SystemDirectory
; string Version
; string WindowsDirectory
;
Win32_BootConfiguration
string BootDirectory
; string ConfigurationPath
; string Name
; string ScratchDirectory
; string SettingID
; string TempDirectory
;
Win32_OSRecoveryConfiguration
boolean AutoReboot
; string DebugFilePath
; uint32 DebugInfoType
; string Description
; string Name
; boolean OverwriteExistingDebugFile
; boolean SendAdminAlert
; string SettingID
; boolean WriteDebugInfo
; boolean WriteToSystemLog
;
Win32_QuickFixEngineering
string Description
; string FixComments
; string HotFixID
; datetime InstallDate
; string InstalledBy
; string Name
; string ServicePackInEffect
;
Win32_ODBCDataSourceSpecification
string CheckID
; string DataSource
; string DriverDescription
; string Registration
; string Version
;
Win32_ODBCDriverSpecification
string CheckID
; string Driver
; string Version
;
Win32_ODBCTranslatorSpecification
string CheckID
; string Driver
; string Version
;
Win32_LocalTime
uint32 Day
; uint32 DayOfWeek
; uint32 Hour
; uint32 Milliseconds
; uint32 Minute
; uint32 Month
; uint32 Quarter
; uint32 Second
; uint32 WeekInMonth
; uint32 Year
;
Win32_TimeZone
sint32 Bias
; string Caption
; sint32 DaylightBias
; string DaylightName
; string SettingID
; uint32 StandardBias
; string StandardName
;
Users
Win32_LogonSession
string AuthenticationPackage
; string Caption
; string LogonId
; uint32 LogonType
; string Name
; datetime StartTime
; string Status
;
Win32_NetworkLoginProfile
datetime AccountExpires
; uint32 AuthorizationFlags
; uint32 BadPasswordCount
; string Comment
; string Description
; string FullName
; string HomeDirectory
; string HomeDirectoryDrive
; datetime LastLogoff
; datetime LastLogon
; string LogonHours
; string LogonServer
; uint64 MaximumStorage
; string Name
; uint32 NumberOfLogons
; datetime PasswordAge
; datetime PasswordExpires
; uint32 PrimaryGroupId
; uint32 Privileges
; string Profile
; string ScriptPath
; string SettingID
; uint32 UnitsPerWeek
; uint32 UserId
; string UserType
; string Workstations
; uint32 Flags
;
Win32_UserAccount
uint32 AccountType
; string Caption
; boolean Disabled
; string Domain
; string FullName
; boolean LocalAccount
; boolean Lockout
; string Name
; boolean PasswordChangeable
; boolean PasswordExpires
; boolean PasswordRequired
;
Win32_Group
string Domain
; string Name
;
Installed Software
Win32_Product
string IdentifyingNumber
; string InstallLocation
; sint16 InstallState
; string Name
; string Vendor
; string Version
;
Networking
Win32_NetworkProtocol
boolean ConnectionlessService
; boolean GuaranteesDelivery
; boolean GuaranteesSequencing
; boolean MessageOriented
; string Name
; string Status
; boolean SupportsBroadcasting
; boolean SupportsConnectData
; boolean SupportsDisconnectData
; boolean SupportsEncryption
; boolean SupportsExpeditedData
; boolean SupportsFragmentation
; boolean SupportsGracefulClosing
; boolean SupportsGuaranteedBandwidth
; boolean SupportsMulticasting
; boolean SupportsQualityofService
;
Win32_PingStatus
(implemented for Windows XP / 2003 Server)
uint32 ResponseTime
; uint32 StatusCode
;
Audio/Video Codecs
Win32_CodecFile
string Description
; string Extension
; string Name
; string Status
; string Version
;
Links
There are several interesting articles on MSDN:
History
- 6th January, 2006 - version 1.0
- basic facilities, command-line interface
- 19th January, 2006 - version 1.01
- source code updated with bug fixes
- 23rd January, 2006 - version 1.02
Win32_NetworkLoginProfile
and Win32_TimeZone
classes added - multiple translation functions added
- silent mode switch and multiple-IPs-at-a-time capability added
- code and XML layout cleaned up
- 26th January, 2006 - version 1.03
Win32_IDEController
, Win32_POTSModem
, Win32_TapeDrive
, Win32_Fan
, Win32_HeatPipe
and Win32_Refrigeration
classes added - fixed bug when saving non-ASCII XML data
- fixed some other minor bugs and typos
- more translation functions added
- code for 'pretty printed'-style XML serialization added
- 6th February, 2006 - version 1.04
Win32_BootConfiguration
, Win32_OSRecoveryConfiguration
, Win32_ODBCDataSourceSpecification
, Win32_ODBCDriverSpecification
, Win32_ODBCTranslatorSpecification
, Win32_PrinterConfiguration
(via Win32_Printer
) and Win32_SystemEnclosure
classes added - minor bugs fixed (within
translate_date
and translate_modem_port
) - added
PrintProcessor
monitoring (Win32_Printer
), PasswordAge
monitoring (Win32_NetworkLoginProfile
) - translation functions added for the introduced classes,
translate_pass_age
added (PasswordAge
of Win32_NetworkLoginProfile
)
- 8th January, 2007 - version 1.1
- all functionality wrapped in
WMIcollector
object - multiple IPs are natively supported by
WMIcollector
- WMI connections are cached
- dropped
xmlAttachChildToParent
method - fixed numerous small bugs and typos
- fixed issues with
Win32_NetworkLoginProfile
flags translate_processor_family
updated
- 25th July, 2007 - version 1.2
- script now accepts DOS-like parameter syntax:
/silent
(silent mode switch) /username
and /password
(alternate credentials) /domain
(alternate domain) and /auth
(Kerberos authentication is used if the value is equal to 'kerberos
')
- all file-system related stuff moved out of
WMICollector
object WMICollector
just populates its _xml array
with DOMDocument
s WMICollector
can now be used outside of WSH (e.g. in Microsoft Internet Explorer user JavaScript)
- 8th January, 2009 - version 2.1
- major rewrite of the script; now 25% smaller and much more manageable
- new UI created for easy IP range typing, managing options and reviewing results
- 28th April, 2009 - version 2.2
- script will now correctly handles connection errors when scanning IP ranges
- fixed dumb error that could lead to querying IPs in eternal cycle
This member doesn't quite have enough reputation to be able to display their biography and homepage.