Windows Management Instrumentation

Are you looking for an administrative solution that you can utilize remotely? Tim Huckaby introduces you to Windows Management Instrumentation (WMI), which lets you do that and more.

Tim Huckaby

July 4, 2000

3 Min Read
ITPro Today logo in a gray background | ITPro Today


Windows Management Instrumentation (WMI) is a scriptable, scalable management infrastructure. WMI is part of Windows 2000 (but available for Windows NT 4.0 and Windows 9x) and can help you manage your enterprise systems, applications, and networks as they become large and complex.

You'll find that WMI has several key features that are extremely valuable in solving the complex administrative tasks that challenge you today. Some of those features and capabilities are

  • Uniform Scripting API

  • Discoverability and navigation

  • Query capability

  • Powerful event publication and subscription

However, what I find most exiting about WMI is its remote administration capabilities. Objects that you manage within WMI are, by definition, available to applications and scripts both locally and remotely. No additional work is necessary for managing remote objects.

Before I delve into the technical details of WMI, let me give you some examples of the power this feature offers. With WMI, you can

  • Identify and list all services on a server that you have configured to run in Automatic Start mode but that are currently stopped

  • Identify and list all the NTFS partitions on a server that have less than 10 percent free space left

  • Execute a backup on a Microsoft SQL Server, then dump the transaction log

  • Launch a program on your server through a WMI method

  • Set up an event consumer that watches for a specific event in the system log, then sends an email message when that event occurs.

  • Reconfigure your event consumer script to request a system event whenever a server's CPU utilization exceeds 90 percent

Now, before you say, "Well, I don't need WMI to do all that," let me tell you that you can do everything that I identified above and

more . . . ON A REMOTE MACHINE! You need a security context to run under and , but you can use WMI to remotely execute a program.

With a Windows Script Host (WSH) script called exec.vbs (which I have made available to "IIS Administrator" subscribers in the IIS Administrator Code Library [http://www.iisadministrator.com]), you can execute programs remotely. Consider the following WSH script command and its parameters:

cscript exec.vbs /e "C:Program FilesInternet _ ExplorerIexplore.exe" /s "TargetServer"  /u _"Administrator" /w "Password"

This command lets you run Microsoft Internet Explorer (IE) on a completely different computer called "TargetServer." Notice that you need to include an account and password that has security privileges on the remote machine.

WMI is modeled on the Web-Based Enterprise Management (WBEM) initiative and the Common Information Model (CIM) that the Distributed Management Task Force (DMTF) adopted. WMI provides a rich, extensible object model that lets you manage computer systems in a consistent, scriptable way—locally or remotely. Most core OS information and services are already instrumented as part of the basic WMI system that comes with Win2K and many other OSs, including third-party services that are under development.

Full documentation about using WMI (and building software that leverages WMI) is available in the WMI software development kit (SDK), which is part of the Microsoft Developer Network (MSDN) Win2K Platform SDK. You can also download the core WMI components needed for NT 4.0 and Win9x systems from this site.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like