WTCS.ORG |
WMI - Windows
Management Instrumentation
Support Page

Installing
WMI on Windows 9x
Installing WMI on Windows 2000
WTCS Script Files Other
Script Links
Windows Scripting Host Download
WMI Links WMI
Downloads
WMI (Windows Management Instrumentation) is Microsoft's implementation of the DMTF (Desktop Management Task Force) standard of WBEM (Web Based Enterprise Management). Enough acronyms for you? Crazy huh?
What is it? Well, it is another (!) MS standard way to access monitor and manage Windows systems, allowing a standard access method to collect performance and operational information. It is fully supported under Windows 2000, and has limited support under Windows NT 4 and Windows 95/98/Me.
I hope this page will give you some insight into the potential for using WMI as a mechanism for collecting performance data from Windows 2000, 98 and XP systems. You will see real examples of disk and memory monitoring. Other tasks that can be done using WMI include NT service monitoring, generating alerts on service start/stop, etc.
Expect to be seeing more (downloadable) WMI and Active-X scripts in the future. Some will be written by me, and some will be those I have tried and use myself.
You should not need to install the Windows WMI 2000 Core components, but if you need to, you can get them here.
I will be adding information here about how to install, configure and use WMI on Windows 2000.
WMI comes pre-installed with Windows 2000, but not with Windows 9x. WMI normally runs as an NT service, but runs as an application under Windows 95/98.
WMI Installation
Download the WMI Core Components for Windows 9x from Microsoft. Go here. You will also find the WMI Core components for Windows NT 4 as well.
For
monitoring a local machine (kind of defeats the point, no?) no special setup is
required, however for remote monitoring over a network, additional setup steps
are required.
Note: Under Windows 95/98,
WMI will start up automatically when you are at the local machine, but WILL
NOT start automatically when connecting remotely. The \windows\system\wbem\winmgmt.exe
program must already be running on the machine being monitored when
connecting from a remote machine or no output will be displayed. There
should be a registry entry in the RunServices key (on the Win9x box) that starts
the WINMGMT.EXE automatically. WMI SHOULD install it, but you might want
to check. Note the registry path at bottom
of the picture):

Installing DCOM - I suggest you get the latest Windows 98 DCOM install file here. Once you have it, you will run the file called dcom98.exe.
Configuring DCOM - This is only required for Windows 95,98, and ME. It is not required for NT or Windows 2000. This allows remote connections to be made.
In order to support remote monitoring with DCOM 98 you must configure DCOM (on the machine to be monitored) in order to permit remote connections.
On the Windows 9x system:
1) From the start menu, enter DCOMCNFG2) Click on the “Default Properties”
tab.

3) Check the checkbox for "Enable Distributed COM on this computer"
4) Make sure the Authentication level is
set to None and the Impersonation level is set to Impersonate.

6) Check the checkbox for Enable remote connection
7) Click the OK button to save these settings
WMIPing.vbs - This file reads from a hosts file (wmiping.hst), and makes a recurring WMI connection to the provider on the host(s) specified in the hosts file. I wrote this because it seems that WMI has a short time-out, and in this way, you don't have to wait while the WMI connection is made (which can seem unbearably long!).

This script is pretty raw, but contains enough comments to help you get it going (I promise)
- Click here to download WMIPing.vbs. You will need to unzip this file!
WMI_FreeDisk.vbs - This is an MRTG
helper file, which is called from the Target[]: line of a standard MRTG config
file. It supports up to 2 disks on a single graph. The command
syntax is as follows:
cscript //nologo path\to\wmi_freedisk.vbs [hostname] [disk1:] [disk2:]
hostname can be IP address as well
disk1: and disk 2: can be the same
For example, here is a screenshot of a request to get disk c: stats from my system:

For example, here is a screenshot of a request to get disk e: and h: stats from my system using the IP address:

You call it in an MRTG config file like so:
Target[WIN2KFS1]: `cscript //nologo path\to\wmi_freedisk.vbs [hostname] [disk1:] [disk2:]`
(note the back-ticks!)
As you can see, the script outputs the data in MRTG-Friendly format. The free disk space is returned in MBytes. Type "cscript //nologo wmi_freedisk.vbs" (omit the "") without any parameters to get usage information
- Click here to download WMI_FreeDisk.vbs. You will need to unzip this file!
WMI_MEMStats.vbs -
Also based
entirely on WMI, this helper script allows you to select a target host, and the
memory stats you want to collect. The command
syntax is as follows:
cscript //nologo path\to\wmi_memstats.vbs [hostname] [statid]

Depending on the StatID you pass the helper, you can get different stats, along with which is passed the system uptime. An example of StatID = 1 (Available Bytes and Committed Bytes) is shown below:

This one needs to be tweaked a little as well. Because the counter data is RAW, counters 2 and 4 must be "Cooked" (calculated) before being presented. This will apparently NOT be a problem with XP. Hmm. Perhaps I will add XP support to the script shortly.
You call this script in an MRTG config file like any other scriptthe otherso:
Target[WIN2KFS1]: `cscript //nologo path\to\wmi_memstats.vbs [hostname] [stat_id]
(note the back-ticks!)
As you can see, this script
also outputs the data in MRTG-Friendly format. StatID 1 and 4 return
data in Bytes.
Type "cscript //nologo wmi_memstats.vbs" (omit the "")
without any parameters to get usage information.
- Click to download WMI_MemStats.vbs. You will need to unzip this file.
PerfStats98.vbs (not publicly available yet) - This help script connects to a WMI provider on a Windows 98 system (I have not tried Windows 95), and allows the collection of some nice stats as you can see. I have not yet turned it into an MRTG helper, but will do so eventually (or if someone gently coerces me into it!).

For any of you who have tried to get this type of information from Win9x using SNMP, you know how hard it can be! This file should get you going on your way to monitoring what you can from Windows 98. Good Luck!
- Click to download PerfStats98.vbs. You will need to unzip this file.
By the way, I recommend you install the latest version of Windows Scripting Host, and they can be found here.
VBScript School - Tutorial
Planet Source Code - Free Active-X/VBScript Code
WSH Utilities and Scripts - Free Scripting Code
Win32 Scripting - Clarence Washington Jr.'s fine site on WSH
WinScripter.com
- Another fine scripting reference site
Download Windows Script 5.6 for Windows 2000 - Microsoft Source
Stay tuned for further information in this section!! Meanwhile, here is a few links to get you "in the know" on WMI!
Windows Management Instrumentation: Background and Overview- Technet article
Managing Windows with WMI - Technet article
WMI Instrumentation Scripting - Clarence Washington's copy of an MS document
Inside Windows Management Interface (Instrumentation) - Win2000 Magazine
How to use WMI - Swynk.com
WMI and Performance Monitoring - Swynk.com
ScriptoMatic WMI code creation tool - Microsoft
Windows Management Instrumentation Tutorial - Microsoft Source
Download WMI Core Components for Windows 9x/NT4 - Microsoft Source. You will need to download and install wmicore.exe (+/- 6.7MB).
Download the WMI SDK (for Windows NT 4.0/2000) - Microsoft Source. You will need this to browse WMI providers, etc. once the Core WMI is installed.
Note:
The Core WMI components are installed by default in Windows 2000. If in
doubt, you can install the WMI core, by running the WMI SDK (wmisdk.exe).
Download the WMI SNMP Provider (for Windows NT 4.0/2000) - Microsoft Source. You will need this if you want to use WMI to get at SNMP information. You must have the Core WMI components installed. You cannot use SNMP to get WMI information (so far as I have been able to find out).
Note:
The WMI SNMP Provider is included in Windows® 2000 but is not installed.
To install it run %systemroot%system32wbemwbemsnmp.exe.
To return the the main page, click the
logo!