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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.