0

I'd like to uninstall some Windows updates that seem to be causing trouble with Outlooks search function. The updates were installed yesterday, so my approach would be something like "List all updates with deployment date xx-xx-xxxx yy:yy:yy" and loop through the result with an uninstall command. So far the theoretical part.

When I try to list the updates in commandline or PowerShell I receive incomplete results (at least when comparing them to the control panel): Screenshot from control panel

I've found multiple ways to list the updates via Powershell or WMI query, but none of them returns valid results:

wmic qfe list (the most prominent way to do it, apparently):

PS C:\Windows\system32> wmic qfe list
Caption                                     CSName       Description      FixComments  HotFixID   InstallDate  InstalledBy          InstalledOn  Name  ServicePackInEffect  Status
http://support.microsoft.com/?kbid=3199986  SRV-CS-TS01  Update                        KB3199986               NT-AUTORITÄT\SYSTEM  11/20/2016
http://support.microsoft.com/?kbid=3202790  SRV-CS-TS01  Security Update               KB3202790               NT-AUTORITÄT\SYSTEM  5/16/2017
http://support.microsoft.com/?kbid=4013418  SRV-CS-TS01  Update                        KB4013418               NT-AUTORITÄT\SYSTEM  5/30/2017
http://support.microsoft.com/?kbid=4023834  SRV-CS-TS01  Update                        KB4023834               NT-AUTORITÄT\SYSTEM  6/26/2017
http://support.microsoft.com/?kbid=4035631  SRV-CS-TS01  Update                        KB4035631               NT-AUTORITÄT\SYSTEM  8/21/2017
http://support.microsoft.com/?kbid=4049065  SRV-CS-TS01  Update                        KB4049065               NT-AUTORITÄT\SYSTEM  11/21/2017
http://support.microsoft.com/?kbid=4093137  SRV-CS-TS01  Update                        KB4093137               NT-AUTORITÄT\SYSTEM  4/23/2018
http://support.microsoft.com/?kbid=4132216  SRV-CS-TS01  Update                        KB4132216               NT-AUTORITÄT\SYSTEM  6/14/2018
http://support.microsoft.com/?kbid=4465659  SRV-CS-TS01  Security Update               KB4465659               NT-AUTORITÄT\SYSTEM  11/15/2018
http://support.microsoft.com/?kbid=4467694  SRV-CS-TS01  Security Update               KB4467694               NT-AUTORITÄT\SYSTEM  11/15/2018
http://support.microsoft.com/?kbid=4471331  SRV-CS-TS01  Security Update               KB4471331               NT-AUTORITÄT\SYSTEM  12/18/2018
http://support.microsoft.com/?kbid=4471321  SRV-CS-TS01  Security Update               KB4471321               NT-AUTORITÄT\SYSTEM  12/18/2018

Get-WMIObject from win32_quickfixengineering:

PS C:\Windows\system32> Get-WmiObject -Class "win32_quickfixengineering"

Source        Description      HotFixID      InstalledBy          InstalledOn
------        -----------      --------      -----------          -----------
SRV-CS-TS01   Update           KB3199986     NT-AUTORITÄT\SYSTEM  20.11.2016 00:00:00
SRV-CS-TS01   Security Update  KB3202790     NT-AUTORITÄT\SYSTEM  16.05.2017 00:00:00
SRV-CS-TS01   Update           KB4013418     NT-AUTORITÄT\SYSTEM  30.05.2017 00:00:00
SRV-CS-TS01   Update           KB4023834     NT-AUTORITÄT\SYSTEM  26.06.2017 00:00:00
SRV-CS-TS01   Update           KB4035631     NT-AUTORITÄT\SYSTEM  21.08.2017 00:00:00
SRV-CS-TS01   Update           KB4049065     NT-AUTORITÄT\SYSTEM  21.11.2017 00:00:00
SRV-CS-TS01   Update           KB4093137     NT-AUTORITÄT\SYSTEM  23.04.2018 00:00:00
SRV-CS-TS01   Update           KB4132216     NT-AUTORITÄT\SYSTEM  14.06.2018 00:00:00
SRV-CS-TS01   Security Update  KB4465659     NT-AUTORITÄT\SYSTEM  15.11.2018 00:00:00
SRV-CS-TS01   Security Update  KB4467694     NT-AUTORITÄT\SYSTEM  15.11.2018 00:00:00
SRV-CS-TS01   Security Update  KB4471331     NT-AUTORITÄT\SYSTEM  18.12.2018 00:00:00
SRV-CS-TS01   Security Update  KB4471321     NT-AUTORITÄT\SYSTEM  18.12.2018 00:00:00

The result of both commands is based on the same WMI query, so I didn't really expect different results here... Some other Powershell Cmdlets I tried provided the same output (Get-WindowsUpdate from Powershell Gallery - "Install-Module -Name PSWindowsUpdate", Get-Hotfix)

I than tried Get-MSIPatchInfo from https://github.com/heaths/psmsi/wiki/Get-MSIPatchInfo - which listed quite a few patches and corresponds with my list in the control panel. Details to the patches reveal the PatchCode, ProductCode, State, Displayname and a boolean field if the Patch is uninstallable, bot no install date.

Am I right to assume, only the latest patches are listed here and can be uninstalled with something like:

Get-MSIPatchInfo | Where-Object {$_.DisplayName -like "*office*"} | Uninstall-MSIPatch -Force
0

Look at the Windows Update Powershell Module install-module pswindowsupdate since that might be a straightforward way to get this done

$history = Get-WUHistory -MaxDate (Get-Date).AddDays(-14)

or however many days you need to go one day beyond the date you want. Pop the variable to see if you have the updates you're looking for write-host $history

Filter that by the date you're looking for

$filterHistory = $history |Where-Object{$_.Date.tostring('yyyy-MM-dd') -like ((get-date).adddays(-13)).tostring('yyyy-MM-dd') -and $_.KB}

The last -and $_.KB is to ensure you're only getting objects with KBArticleIDs

Then feed that to the Remove-WindowsUpdate

$filterHistory | Remove-WindowsUpdate -KBArticleID $_.KB -whatif

remove that -whatif if you're satisfied with what it will do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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