First of all, you have to check for the silent uninstall command.
For this purpose I usually use this tool: https://www.nirsoft.net/utils/uninstall_view.html
UninstallView is a tool for Windows that collects information about all programs installed on your system and displays the details of the installed programs in one table. You can use it to get installed programs information for your local system, for remote computer on your network, and for external hard-drive plugged to your computer. It also allows you to easily uninstall a software on your local computer and remote computer (Including quiet uninstall if the installer supports it).
The tool displays the silent uninstall command.
If you find the command, try it out manually. Sometimes, even a command is provided, silent uninstall doesn't work as expected.
Second, my recommendation is not to use WMI for uninstall, cause it is slow in determine the installed programs. Instead check for the registry key, which is also displayed by the tool.
To be more generic, read in these keys
HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
search for DisplayName with a where statement and execute the command in the quietuninstall key.
Answer from Hans Hubert Vogts on Stack ExchangeFirst of all, you have to check for the silent uninstall command.
For this purpose I usually use this tool: https://www.nirsoft.net/utils/uninstall_view.html
UninstallView is a tool for Windows that collects information about all programs installed on your system and displays the details of the installed programs in one table. You can use it to get installed programs information for your local system, for remote computer on your network, and for external hard-drive plugged to your computer. It also allows you to easily uninstall a software on your local computer and remote computer (Including quiet uninstall if the installer supports it).
The tool displays the silent uninstall command.
If you find the command, try it out manually. Sometimes, even a command is provided, silent uninstall doesn't work as expected.
Second, my recommendation is not to use WMI for uninstall, cause it is slow in determine the installed programs. Instead check for the registry key, which is also displayed by the tool.
To be more generic, read in these keys
HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
search for DisplayName with a where statement and execute the command in the quietuninstall key.
Uninstall an application silently
To uninstall an application, you can run the uninstall process as a startup script so it does not require any end-user input or interaction to complete the uninstall operation.
Since you are using PowerShell and already have logic you confirm uninstalls the application you need, the example provided will build off of that to keep it simple and basic.
Furthermore, beneath that I will provide an additional but different (and more efficient) way to uninstall the package using PowerShell since you are using Windows 10.
PowerShell Script (existing logic)
Note: Save this to
C:\Scripts\Test.ps1or on the local machine or perhaps a UNC path that you've grantedDomain Computersand/orAuthenticated Usersto the folder and the share.$app = Get-WmiObject -Class Win32_Product | ?{$_.name -eq "HP Support Assistant"}; $app.Uninstall();PowerShell Script (more effecient logic)
Note: This uses Get-Package with the package name and pipes that over to Uninstall-Package to uninstall the application from Windows.
$pName = "HP Support Assistant"; Get-Package $pName | Uninstall-Package;
Run as a startup script using Group Policy settings
Note: Use
gpedit.mscon the local machine to run the script as a Startup Script or if you are able use Group Policies from Active Directory if applicable in a domain environment.
- Go to
gpedit.msc - Navigate
Computer Configurations|Windows Settings|Scripts (Startup/Shutdown) - Click on
Startup|PowerShell Scriptstab |Addoption - Point the
Script Namefield to the full path of the startup script location Press
OKand/orApplyout of all existing screens to save the settingsLastly, you will just want to restart the computer to ensure the startup script runs and uninstalls the application without any need for user interaction or input.

Other Potential Solution
According to an answer on the HP Silent Uninstall HP Support Assistant post, you can also uninstall the HP Support Assistant application while logged on and not as a login script silently using:
"C:\Program Files (x86)\Hewlett-Packard\HP Support Framework\UninstallHPSA.exe" /s /v /qn
Supporting Resources
- Get-Package
- Uninstall-Package
windows - How can I uninstall an application using PowerShell? - Stack Overflow
Need PowerShell working script to uninstall software from Control Panel,Registry
Software Uninstaller Script (Silent)
uninstallation - Uninstall Chrome silently using Powershell - Stack Overflow
Videos
I would like to uninstall an application using registry paths as this is what I can view in Defender for users devices.
When using the following command it works but a prompt is still coming up. I have tried adding different switches but not getting any where. Is this even possible if the app does not have a QuietUninstallString listed?
$paths = 'REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{6FB7DAEC-5DAD-491E-9951-4684423F291C}'
$app = Get-ItemProperty $paths | Select-Object UninstallString
$app.UninstallString | cmdThank you
You could use this PowerShell fragment :
$program = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match "Part of App Name" } | Select-Object -Property DisplayName, Uninstallstring, QuietUninstallString
start-process cmd.exe -argumentlist "/c ""
prog.quietUninstallString) /norestart""" -Wait
Where "Part of App Name" is enough to uniquely identify the product.
I was able to write a small PowerShell script for my specific need:
# Name of the software to check
$softwareName = "O365ProPlusRetail - de-de"
# Check if software is installed
$software = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object { $_.PSChildName -match $softwareName }
if ($software -ne $null) {
# Software is installed, uninstall it
& 'C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe' scenario=install scenariosubtype=uninstall sourcetype=None productstoremove=O365ProPlusRetail.16_de-de_x-none culture=de-de version.16=16.0 DisplayLevel=False forceappshutdown=true
Write-Host "$softwareName has been uninstalled."
}
else {
# Software is not installed
Write-Host "$softwareName is not installed."
}
it works for me but this is not a general solution.
$app = Get-WmiObject -Class Win32_Product | Where-Object {
$_.Name -match "Software Name"
}
$app.Uninstall()
Edit: Rob found another way to do it with the Filter parameter:
$app = Get-WmiObject -Class Win32_Product `
-Filter "Name = 'Software Name'"
EDIT: Over the years this answer has gotten quite a few upvotes. I would like to add some comments. I have not used PowerShell since, but I remember observing some issues:
- If there are more matches than 1 for the below script, it does not work and you must append the PowerShell filter that limits results to 1. I believe it's
-First 1but I'm not sure. Feel free to edit. - If the application is not installed by MSI it does not work. The reason it was written as below is because it modifies the MSI to uninstall without intervention, which is not always the default case when using the native uninstall string.
Using the WMI object takes forever. This is very fast if you just know the name of the program you want to uninstall.
$uninstall32 = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "SOFTWARE NAME" } | select UninstallString
$uninstall64 = gci "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "SOFTWARE NAME" } | select UninstallString
if ($uninstall64) {
$uninstall64 = $uninstall64.UninstallString -Replace "msiexec.exe","" -Replace "/I","" -Replace "/X",""
$uninstall64 = $uninstall64.Trim()
Write "Uninstalling..."
start-process "msiexec.exe" -arg "/X $uninstall64 /qb" -Wait}
if ($uninstall32) {
$uninstall32 = $uninstall32.UninstallString -Replace "msiexec.exe","" -Replace "/I","" -Replace "/X",""
$uninstall32 = $uninstall32.Trim()
Write "Uninstalling..."
start-process "msiexec.exe" -arg "/X $uninstall32 /qb" -Wait}
You need two more quotes around the argumentlist. This will force a reboot as they are uninstalled in my test. You could probably avoid that with an additional switch though.
Edit: this should be the final one.
$program = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match 'c\+\+ 2015-' } | Select-Object -Property DisplayName, Uninstallstring, QuietUninstallString
foreach($prog in $program){start-process cmd.exe -argumentlist "/c ""$($prog.quietUninstallString) /norestart""" -Wait}
Hi Experts,
I have to uninstall Microsoft Visual C++ 2019 X64 Additional Runtime - 14.29.30133 & Microsoft Visual C++ 2019 X86 Additional Runtime - 14.29.30133 software from my Control panel and Registry.
caa06090-a4f2-4a72-a496-f129b0aaa1ac-Control_panel.PNG745×163 50.5 KB
I have tried from the below powershell code, I am not getting any error. But Its not uninstalling. Not working.
Can someone provide me effective powershell script to uninstall it.
I am looking forward to hear from you.
$Myapp1 = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Microsoft Visual C++ 2019 X64 Additional Runtime - 14.29.30133"}
$Myapp1.Uninstall()
$Myapp2 = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "Microsoft Visual C++ 2019 X86 Additional Runtime - 14.29.30133"}
$Myapp2.Uninstall()
Hey guys
here's the full script for who wants it, it is a simple script to uninstall multiple applications at once if you want. (Select multiple applications in the out-gridview and press "ok")
Be very careful using this script! Use it at your own risk and if you know what you are doing.
Any positive/negative criticism is always welcome in order for me to improve my skills.
Thank you!
$MsgIntro = @'
*********************** ***********************
Software Uninstaller Tool Made by PRIDEVisions
*********************** ***********************
'@
write-host -ForegroundColor Magenta "$MsgIntro"
Write-host -ForegroundColor Magenta "Please select the software you wish to uninstall..."
Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | select Displayname, InstallLocation, UninstallString | sort | Out-GridView -PassThru -OutVariable software
write-host -ForegroundColor Yellow "The following software will be uninstalled:"
foreach ($application in $software) {
write-host "$Application"
$uninstall = $Application.UnInstallString
cmd /c $uninstall /quiet /norestart
}Original question regarding this script: https://www.reddit.com/r/PowerShell/comments/7sdc0u/readhost_interrupting_script/
Edit: Quickly adjusted the script for both 32-bit & 64-bit software versions (It's not fully changed as i would like to but now it works better).
$MsgIntro = @'
*********************** ***********************
Software Uninstaller Tool Made by PRIdEVisions
*********************** ***********************
'@
write-host -ForegroundColor Magenta "$MsgIntro"
Write-host -ForegroundColor Magenta "Please select the software you wish to uninstall..."
$Software = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" | select DisplayName, UninstallString, InstallLocation, InstallDate | out-gridview -PassThru
write-host -ForegroundColor Yellow "The following software will be uninstalled:"
foreach ($application in $Software) {
if ($application.UninstallString -like "MsiExec*") {
write-host "$Application"
$uninstall = $Application.UnInstallString
cmd /c $uninstall /quiet /norestart
}
else {
$uninstall = $Application.UnInstallString
& "$uninstall"
}
}If it's an msi you can use uninstall-package:
get-package *chrome* | uninstall-package -whatif
instead of trying to use /X and remove /X and other things, try the following
# Get the key to uninstall
$chromeUninstall = $Chrome.Pspath.Split("\")[-1]
Start-Process -Wait -FilePath MsiExec.exe -Argumentlist "/X $ChromeUninstall /quiet /norestart"
or even simpler would be,
Start-Process -Wait cmd.exe -ArgumentList "/c msiexec /X $ChromeUninstall /quiet /norestart"
/c - Carries out the command specified by string and then terminates
Note
On my system I get two uninstall strings. You might want to think about looping or selecting first one in the list with the use of [0]