Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


February 2008

Get Hotfix Information Quickly with WMIC

RSS
Subscribe to Windows IT Pro | See More Hotfixes Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

Executive Summary:
Microsoft Windows Management Instrumentation (WMI) offers numerous classes and properties that you can use to retrieve information about local and remote computers. The Windows Management Instrumentation Command-line (WMIC) utility brings that functionality to the command line. This article explores how you can use the Windows Management Instrumentation Command-line utility to retrieve the IDs of all the hotfixes installed on the local machine.


There are dozens of different ways to find the hotfixes installed on computers, but the fastest and simplest way is to use a widely available tool named Windows Management Instrumentation Command-line (WMIC). With WMIC, getting the IDs of all the hotfixes installed on the local system can be done with this short command

wmic qfe get Hotfixid

If you aren’t familiar with WMIC and want an even shorter command to remember, you can cut the command down to

wmic qfe

Besides displaying the IDs, this command displays other details (e.g., hotfix name, hotfix installation date) about the installed hotfixes, which can be helpful.

If you just need to determine whether a specific hotfix is installed, you can avoid searching through a long list of hotfixes by piping the wmic qfe command’s output through the Find command. For example, if you want to see whether hotfix 938194 is installed on the local machine, you can run the command

wmic qfe | find “938194”

Note that you need to enclose the search string (in this case, 938194) in quotes.

At this point, you might be wondering what qfe is. In WMIC, you use aliases such as qfe to specify the Windows Management Instrumentation (WMI) class you’re interested in retrieving information from. In WMIC, an alias is essentially a nickname. Just like it’s easier to remember people’s nicknames than their full names, it’s easier to remember classes’ aliases than their full names. Besides helping with familiarity, aliases reduce what you have to type on the command line and can help differentiate between classes with similar names.

Although WMIC assumes that you’re using aliases on the command line, you can use standard Windows Management Instrumentation (WMI) class paths instead. For example, qfe is the alias for WMI’s Win32_Quick- FixEngineering class, therefore

wmic qfe get Hotfixid

is equivalent to

wmic path win32_quickfixengineering get Hotfixid

The path keyword that precedes the name of the WMI class tells WMIC that the path to a WMI class follows. So, if you don’t know a particular WMIC alias for a WMI class, all you need to do is use the path keyword followed by the class’s name.

There are several reasons why I use WMIC for checking hotfixes. As I mentioned earlier, it’s fast. You can type the entire command in an open command-prompt window more quickly than you can navigate to most programs on the Windows Start menu. It’s simple because you don’t need to install special programs to perform the query for you. Equally important, you can use it with virtually any Windows OS. Although WMIC has been around only since Windows XP, you can use WMIC’s /node parameter to run the utility remotely against earlier Windows OSs, as long as those OSs are running WMI. For example, to check for hotfixes on a Windows NT 4.0 system named LegacyHost that has the NT 4.0 WMI extensions installed, you’d run the command

wmic /node:legacyhost qfe get Hotfixid

There’s another reason to use WMIC for getting hotfix information. If you don’t already use WMIC, it gives you an opportunity to become familiar it, which has an immense long-term payoff: One tool is all you’ll need to find out information about any WMI property on any system you’re connected to. All you need to know is the property’s name and the appropriate alias. For example, if you want the names of all the printers on the local system, you’d use the printer alias with the Name property in the command

wmic printer get Name

Need the CPU speed on the local machine? Simply run

wmic cpu get CurrentClockSpeed

The built-in aliases that are available for use can differ depending on the OS you’re using. For example, if you need to find the memory currently installed on a Windows XP computer, you’d need to use

wmic memlogical get totalphysicalmemory

But on a Windows Server 2008, Windows Vista, or Windows Server 2003 machine, the command would be

wmic memorychip get Capacity

On the Windows IT Pro Web site, you can download a Microsoft Excel spreadsheet that shows the differences between WMIC aliases on various OS versions. Go to www.windowsitpro.com/Windows/Article/ArticleID/97781/97781.html and click the Download the Code Here button near the top of the page. The 97781.zip file that you download will contain the spreadsheet.

For more detailed information about WMIC’s options, you can check the built-in Help feature with one of the following commands:

wmic /?
wmic /?:full

Spending a little time learning about these options will pay off later when you need quick access to particular information about the systems you support.

End of Article



Reader Comments

You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Microsoft: Save Money ... By Paying for Software

Microsoft this week adopted an interesting tactic in its long-running battle with open source software: Businesses looking to save money over the long haul should simply pay for software instead of moving to free, open source solutions. The rationale? ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Microsoft Delivers Service Pack 2 Beta 2 for Vista, Server 2008

Microsoft on Tuesday announced the availability of the Beta 2 version of Service Pack 2 (SP2) for Windows Vista and Windows Server 2008. Since both operating systems were developed from the same code base, they have a common servicing structure and thus ...


Related Articles Rem: Disabling System Restore

Rem: Retrieving a Computer’s Manufacturing Information

What is the Windows Management Instrumentation Command-line (WMIC)?

WMIC

Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing