Basic Uses of the WMI (Windows Management Instrumentation) Command Line for Administration

By Michael Sinno, published Apr 05, 2007
Published Content: 4  Total Views: 1,704  Favorited By: 0 CPs
Embed:  
Rating: 3.0 of 5
WMI stands for Windows Management Instrumentation. It is most frequently used for management and monitoring of Servers and Workstations through scripts. However, for you non scripter's out there (you know you are) can still leverage the power of WMI. While not as powerful as a fully scripted WMI solution it still provides mountains of useful features that you can leverage right now. Better yet, I have found that it functions as a great gateway drug to help people realize the power of scripting. This overview barely scratches the surface as to what is available, but it provides the basic knowledge needed to start playing with the command line.

Right now you're probably thinking. How do I get it? Well, the odds are you already have it and just need to use it. Microsoft included it with the following operating systems:

Windows XP
Windows Server 2003
Windows Vista

In order to access it you simply need to drop into a command prompt and type in "wmic". It will most likely give you a message asking you to wait while the WMIC installed. Once this is complete you will be greeted with the following prompt:

wmic:root\cli>

So now what? In order to get started just type in /? to get a listing of the global switches and aliases. The global switches specify how and where a particular WMI query should be run and the aliases specify the actual information. For example, let's say you want to find out information relating to the operating system. At the wmic prompt type in:

os

This outputs relevant data that is located in the os alias. There is a problem though. The data is output in a very unfriendly format that requires you to scroll instead of down. It's actually quite a pain!
There are several solutions to this and they can all be found by using /?. Now, type in:

os /?

You will see a listing of the global verbs. Just as we learned in English class these are the action words. They help you to do something with the data. There is a "list" verb that will let you determine how you want the data listed. Within the list verb there are several options for how the output can be displayed. These can be accessed by typing in the following:

os list /?

Takeaways
  • Using WMI for Data Collection
  • Using WMI to enable Remote Desktop Services
Comments
Type in Your Comments Below - (1000 characters left)
Your name:

Submit your own content on this or any topic. Get started »
Most Commented On