Using Get-Hotfix to get a list of installed hotfixes

by Bharat Suneja on September 20, 2010

Exchange Server 2010 Service Pack 1 requires a number of hotfixes to be installed. These are listed in Exchange 2010 Prerequisites in Exchange 2010 documentation and in the Exchange 2010 SP1 FAQ and Known Issues post on the Exchange team blog.

While preparing a server for SP1, I erroneously kept trying to install the hotfixes on the Hyper-V host sytem, which has Windows 2008 R2 (instead of the VM running Windows Server 2008 SP2). Obviously, none of the hotfixes I downloaded for Windows 2008 SP2 would apply, and the hotfix installer kept informing me about the same.


Figure 1: Error when installing a hotfix for Windows 2008 R2 on a Windows 2008 SP2 server

To get a list of hotfixes installed on your system, you can use the Get-Hotfix cmdlet available in Windows PowerShell v2. If you simply use the Get-Hotfix cmdlet without any parameters, it retrieves a list of all hotfixes. The default output includes the following properties:

  • Source (server)
  • Description (Hotfix | Update | Security Update | Service Pack)
  • HotFixID (for example, KB973136)
  • InstalledBy (user)
  • InstalledOn (date/time installed)

You can also use the Id parameter to specify one or more hotfixes:

Get-Hotfix -Id kb979744

To determine whether the hotfixes required for Exchange 2010 SP1 (on Windows 2008 SP2) are installed on a server, use the following command:

Get-Hotfix kb973136,kb977592,kb977624,kb979099,kb979744,kb982867,kb979917

On the first run, I found only two of the required hotfixes were installed:

Source Description HotFixID InstalledBy InstalledOn
—— ———– ——– ———– ———–
EX2 Hotfix KB977624 E14LABS\Administr… 8/27/2010 10:29:01 AM
EX2 Update KB979099 E14LABS\Administr… 8/27/2010 10:29:01 AM

After I installed the missing hotfixes, I ran the cmdlet again. The result:

Source Description HotFixID InstalledBy InstalledOn
—— ———– ——– ———– ———–
EX2 Hotfix KB973136 E14LABS\Administr… 9/19/2010 12:27:04 AM
EX2 Hotfix KB977592 E14LABS\Administr… 9/19/2010 12:29:06 AM
EX2 Hotfix KB977624 E14LABS\Administr… 8/27/2010 10:29:01 AM
EX2 Update KB979099 E14LABS\Administr… 8/27/2010 10:29:01 AM
EX2 Hotfix KB979744 E14LABS\Administr… 9/19/2010 12:30:34 AM
EX2 Hotfix KB979917 E14LABS\Administr… 9/19/2010 12:37:11 AM
EX2 Hotfix KB982867 E14LABS\Administr… 9/19/2010 12:35:45 AM

The Get-HotFix cmdlet makes finding installed or missing hotfixes quick and easy using a one-liner command, a huge improvement from the many lines of code required in the VBScript + WMI days (although the cmdlet also uses the Win32_QuickFixEngineering WMI class).

High on my wishlist: the -DownloadAndInstallMissingHotfixes switch for this cmdlet!

{ 2 comments… read them below or add one }

Leave a Comment

Previous post:

Next post: