Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm in a situation where I need to uninstall all windows updates before a certain date to troubleshoot a strange bug. I found several vb/ps scripts to do this

remove single update

However I'm trying to get at something along the lines of where date > 1/9/13 get rid of it !

The reason I ask is I feel like this is something I end up running into from time to time and ends up being pretty time consuming. Any ideas ?

I also found the following

wmic qfe get hotfixid,installedon | findstr %01/09/13% >> c:\list.txt

However this doesn't seem to return an accurate result set

I'm currently working with a windows server 2003 box. Thanks in advance.

share|improve this question
Which version PowerShell can you use? Check $PSVersionTable – jscott Mar 13 '13 at 17:59
@jscott I have PS 2.0 on there now but I'm pretty sure you can run 3.0 on 2003/XP no ? – bumble_bee_tuna Mar 13 '13 at 18:04
up vote 1 down vote accepted

Here's one way to filter hotfixes by date using VBScript. You could easily convert it to PowerShell if needed or just call your PowerShell code to remove each hotfix that matches the filter.

On Error Resume Next
Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim UserName
Dim Password
Dim colItems

Dim dateFilter

dateFilter = CDate("1/9/2013")

strComputer = "."
UserName = ""
Password = ""
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_QuickFixEngineering",,48)
For Each objItem in colItems
    hotFixID = objItem.HotFixID
    installDate = objItem.InstallDate

    If IsNull(installDate) Or Trim(installDate) = "" Then
        installDate = objItem.InstalledOn
    End If

    If IsDate(installDate) Then
        If CDate(installDate) > dateFilter Then
            WScript.Echo hotFixID & vbTab & installDate

            ' Call your remove hotfix script or code and pass it the hotFixID and optionally, the machine name
        End If
    End If
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.