1

Is there a simple way of uninstalling Software UPDATES (Service Packs) listed in Programs and Features\Installed Updates with Powershell?

I am not talking about Windows Updates. But a specific software Service Pack that is listed in the same place where the win updates are.

I know how to uninstall Software that is listed in programs and features with PS But could not figured it out how to remove the Software updates/Service Packs

this command will list all the software

Get-WmiObject -Class Win32_Product | Select-Object -Property Name

or this one

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate,UninstallString | Format-Table –AutoSize

this will remove the software but i need to remove the software Service Pack( UPDATE) only,

$app = Get-WmiObject -Class Win32_Product | Where-Object { 
    $_.Name -match "Software Name" 
}

$app.Uninstall()

I have seen that post already: How can I uninstall an application using PowerShell?

I hope that I am clear enough, thanks

long story short is that I need a command that will list or/and remove selected software UPDATES (service packs etc), thanks

any ideas, thanks

greenszpila
  • 193
  • 1
  • 1
  • 14
  • 1
    What program's update are you trying to revert? Or are you referring to a Windows Update? – MF- Jan 22 '21 at 16:17

1 Answers1

0

Have you tried to search for any similar topics? I found like 9+

What you're looking for is this:

$app = Get-WmiObject -Class Win32_Product | Where-Object { 
    $_.Name -match "Software Name" 
}

$app.Uninstall()

or, $app = Get-WmiObject -Class Win32_Product -Filter "Name = 'Software Name'"

pulled from: How can I uninstall an application using PowerShell?

Other useful links:

https://redmondmag.com/articles/2019/08/27/powershell-to-uninstall-an-application.aspx

https://www.slashadmin.co.uk/how-to-uninstall-programs-using-powershell/

All with the same conclusions of calling on the method to .uninstall.

for updates:

We can also use DISM for updates:

$SearchUpdates = dism /online /get-packages | findstr "Package_for"
$updates = $SearchUpdates.replace("Package Identity : ", "") | findstr "KBXXXXXX"
#$updates
DISM.exe /Online /Remove-Package /PackageName:$updates /quiet /norestart

Or native powerhsell cmdlets of Get-Package, and uninstall-package.

Made this quick script as a selection for your updates.

$Updates = Get-Package -Name "*Update*" | Select-Object -ExpandProperty Name
for($i=0; $i -lt $Updates.Count; $i++){
write-host "$($i): $($Updates[$i])"    
    }

$Selection = Read-Host -Prompt "Enter number of updates you would like to uninstall"
$Selection = $Selection -split " "


Foreach($Update in $Updates[$Selection]){
    Uninstall-Package -Name $Update -whatif
    }

Wusa.exe can also give you similar results if youre familiar with the syntax for it. Run wusa.exe /?. Ex: Wusa /uninstall /KB:KB1234567

Please note, ive only had real success in the past just uninstalling KBs using Wusa. DISM seems to work most of the time, but theres a lot of options available.

Abraham Zinala
  • 4,267
  • 3
  • 9
  • 24
  • I know how to uninstall application, how about the applications update? the question is how to uninstall applications update only, – greenszpila Jan 22 '21 at 16:29
  • thanks for your answer but `dism /online /get-packages` displays only Microsoft software updates. I need to be able to list a service packs and updates for a third party software not a microsoft one, so your solution did not work for me, but thanks. – greenszpila Jan 25 '21 at 12:32