fbpx Determine Whether a Hotfix Is Installed in Windows PowerShell | Windows PowerShell, Windows Server | HostingUltraso.com
24/7/365 Support

Determine Whether a Hotfix Is Installed in Windows PowerShell

Problem

You want to determine whether a specific hotfix is installed on a system.

Solution

To retrieve a list of hotfixes applied to the system, use the Win32_ QuickfixEngineering WMI class: PS >GetWmiObject Win32_QuickfixEngineering Filter "HotFixID='KB925228'"

Description : Windows PowerShell(TM) 1.0 FixComments : HotFixID : KB925228 Install Date : InstalledBy : InstalledOn : Name : ServicePackInEffect : SP3 Status :

To determine whether a specific fix is applied, use the TestHotfixInstallation script provided in Example 245:

PS >TestHotfixInstallation KB925228 LEEDESK True PS >TestHotfixInstallation KB92522228 LEEDESK False

Discussion

Example 245 lets you determine whether a hotfix is installed on a specific system. It uses the Win32_QuickfixEngineering WMI class to retrieve this information.

Example 245. TestHotfixInstallation.ps1

############################################################################## ## ## TestHotfixInstallation.ps1 ## ## Determine if a hotfix is installed on a computer ## ## ie: ## ## PS >TestHotfixInstallation KB925228 LEEDESK ## True ## ##############################################################################

param( $hotfix = $(throw "Please specify a hotfix ID"), $computer = "." )

## Create the WMI query to determine if the hotfix is installed $filter = "HotFixID='$hotfix'" $results = GetWmiObject Win32_QuickfixEngineering `

Filter $filter Computer $computer

## Return the results as a boolean, which tells us if the hotfix is installed [bool] $results

Help Category:

Get Windows Dedicated Server

Only reading will not help you, you have to practice it! So get it now.

Processor RAM Storage Server Detail
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 128 GB (SSD SATA) Configure Server
Intel Atom C2750 2.4 GHz 8c/8t 8 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Xeon E3-1230 v2 3.3 GHz 4c/8t 16 GB DDR3 1× 256 GB (SSD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 250 GB (SSD SATA) Configure Server

What Our Clients Say