i tried to uninstall puppet-agent-x64 silently used this command:
$registryPath = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | Get-ItemProperty | Where-Object {
$_.displayName -eq "Puppet Agent (64-bit)"
} | Select-Object -Property UninstallString
$uninstall = $registryPath.UninstallString
& cmd /c $uninstall /qn /norestart
and one can still finding the program under appwiz.cpl
Any hence please!
I created a script to uninstall an application silently from the reg keys. It's worked for a few different apps without an issue. I'm trying to uninstall brave browser but, I keep getting this error below. I think the reason is because the uninstall string for brave is
C:\Program Files\BraveSoftware\Brave-Browser\Application\95.1.31.91\Installer\setup.exe" --uninstall --system-level.
The --uninstall and --system-level may be causing the error and I'm not to sure how to get around it.
Any ideas are greatly appreciated.
Error Message Below
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:11 char:40
... isplayName){Start-Process -Wait -FilePath "$remove32" -ArgumentList "
$appName = "brave"
$32bit = get-itemproperty 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall*'| Where-Object { $.DisplayName -match "^$appName"} | Select-Object DisplayName, DisplayVersion, UninstallString| Where-Object { $.DisplayName -match "^$appName"}
$remove32 = $32bit.UninstallString
$64bit = get-itemproperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall*' | Where-Object { $.DisplayName -match "^$appName"} | Select-Object DisplayName, DisplayVersion, UninstallString | Where-Object { $.DisplayName -match "^$appName"}
$remove64 = $64bit.uninstallstring
if ($appName -like $32bit.DisplayName){Start-Process -Wait -FilePath $remove32 -ArgumentList "/S" -PassThru}
else {Start-Process -Wait -FilePath $remove64 -ArgumentList "/S" -PassThru}enter code here
It's kind of a pain, but you need to parse the command from the arguments somehow. Also the silent install option might not be '/S'. I think I've seen '--force-uninstall'. It's easier with msi installs. You can just use uninstall-package.
$uninstallstring = '"C:\Program Files\BraveSoftware\Brave-Browser\Application\95.1.31.91\Installer\setup.exe" --uninstall --system-level'
$split = -split $uninstallstring
& (-join $split[0..1]) $split[2] $split[3]
Note that you can get the uninstallstring from get-package too.
$uninstallstring = get-package *brave* | % { $_.metadata['uninstallstring'] }
Looking to execute a powershell command that will uninstall an application and clear some registry entries if either a file/folder is not present on the system.
Currently looking at something like this:
if(!(test-path “c:\Windows\mdm” )
{
$productdetails=(Get-WmiObject -Query “Select IdentifyingNumber from win32_product where name = ‘Tesapp’“).identifyingnumber
$proc=(Start-Process -FilePath “msiexec.exe” -ArgumentList “/x $productdetails /qn /l*v c:\temp\Uninstall-testapp.log” -Wait -PassThru).ExitCode
if (!($proc -eq 0 -or $proc -eq 3010))
{
exit(1)
}
$RegKey=“HKLM:\SOFTWARE\Microsoft\TestAppManagement\S-0-0-00-0000000000-0000000000-000000000-000\MSI\{0}” -f $productdetails
if(test-path $RegKey)
{
$op= Get-Item $RegKey | Out-File “c:\windows\temp\TestApp_Reg_backup.reg” -Force
$op= Remove-Item $RegKey -Force
}
}
Interestingly if I run the test path it will return false which is expected, or if run the app uninstall/reg clear on its own it will work as intended - however i cannot run them together.
I assume i am making some sort of syntax/ basic logic error?
So there was an article that came out about support assist being vulnerable, bla bla.
Upper management has deemed support assist to be unsafe and has ordered it removed from every machine.....
no I cannot/will not try to convince them otherwise, this is going to happen one way or another
Trying to get this done has been a nightmare for the past 8 hours while I try unsuccessful script after the next only to have this damned program NOT DIE
Here is what I have so far
MsiExec.exe /X "{0309AC01-330F-494C-B27D-58E297E4674F}" /quiet
MsiExec.exe /X "{F1D17890-F41B-4BFA-8893-B2C8A248BE0D}" /quiet
$CurrentSAPkg = Get-WMIObject -Class Win32_Product | Where-Object { $_.Name -like "Dell*" }
$CurrentSAPkg.Uninstall()
& "C:\Program Files\Dell\SupportAssist\uninstaller.exe" /arp /S
The get-WMIObject part works, and the uninstaller.exe /arp /S works
however those only work for the older versions, newer versions require something more like the top two commands, but there is a problem
the /quiet flag makes it not work. if I omit the quiet flag I get a popup, "Are you sure" yes, it uninstalls, with the quiet flag, nothing happens, the program stays
I use the folowing to get the uninstall paths
$regQuery32 = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | Where {$_.GetValue("DisplayName") -match "Dell*"}
I really hate support assist now and I want it to die and I am at my wits end.
So I am having the exact opposite issue. I was able to get the newer versions to remove, but anything that returned "C:\Program Files\Dell\SupportAssist\uninstaller.exe /arp" as the UninstallString is failing in my automation as I can't get the prompt to not display (I have around 700 agents to remove this crap from, some with multiple versions, so I feel your pain).
For the newer versions, I used:
$SAVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Where-Object {$_.DisplayName -match "SupportAssist" } |
Where-Object {$_.DisplayVersion -notlike "3.2*"} |
Select-Object -Property DisplayVersion, UninstallString, PSChildName
ForEach ($ver in $SAVer) {
If ($ver.UninstallString) {
$uninst = $ver.UninstallString
& cmd /c $uninst /quiet /norestart
}
}
I am going to look into the method you are showing for the older version (2.0 and earlier) to see if this resolves my issue. Hopefully my code snippet will help with yours. Cheers.
Ran into a similar problem. I had a bunch of computers all with different versions of Support Assist. I compiled this from a few different sources. So far I have had really good success. I am using PDQ deploy. I am not the most PowerShell proficient but perhaps this will help.
"C:\ProgramData\Package Cache\{ec40a028-983b-4213-af2c-77ed6f6fe1d5}\DellUpdateSupportAssistPlugin.exe" /uninstall /quiet
MsiExec.exe /qn /norestart /X{E98E94E2-12D1-48E5-AC69-2C312F466136}
MsiExec.exe /qn /norestart /X{806422F1-FC4E-4D7C-8855-05748AEFC031}
MsiExec.exe /X{0309AC01-330F-494C-B27D-58E297E4674F} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{122666A9-2995-4E47-A75E-6423A827B7AF} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{18EF001B-B005-46CB-917B-112BA69ED85E} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{1AE53ECE-2255-4191-998B-07741E5EFCDA} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{33E712C1-2183-421C-9BC8-C902DB9C596C} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{45FD01F4-B11B-4A58-B465-1D600B5CDF64} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{4CB4741A-20C1-454E-8276-993D06A76D67} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{50EF2C72-95EC-4206-AAC3-9E84004A6140} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{5A18ABE3-52D1-4CA5-9169-25EC7E789582} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{8D7B279C-A661-465C-9658-F62FBD6A6B91} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{9074E264-F615-4DDE-969E-1FDBCFEC3FB5} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{90881C8E-6C4F-4662-9923-85AFCA058C44} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{9DD6B149-CEBC-4910-B11A-242393EDF6D3} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{D793D5B1-A985-4443-90F4-E55A13CFF117} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{E98E94E2-12D1-48E5-AC69-2C312F466136} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{806422F1-FC4E-4D7C-8855-05748AEFC031} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{27130E51-9555-408B-8134-7BFF54EDE27B} /qn REBOOT=REALLYSUPRESS
MsiExec.exe /X{3ED468C2-2235-4747-90AD-A7A34F0FE70A} /qn REBOOT=REALLYSUPRESS
taskkill /im SupportAssistAgent.exe /f /t
net stop SupportAssistAgent
sc delete SupportAssistAgent
rd "C:\Program Files\Dell\SupportAssist"/s /q
rd "C:\Program Files\Dell\SupportAssistAgent" /s /q
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PC-Doctor for Windows" /f
del "C:\Users\Public\Desktop\SupportAssist.lnk" /f /q
Sources:
https://community.spiceworks.com/topic/2229972-using-pdq-deploy-to-uninstall-dell-supportassist
https://www.dell.com/community/SupportAssist-for-PCs/Silently-Update-SupportAssist-in-background/td-p/7294483
Have you tried something like:
get-package *dell* | uninstall-package -whatif
I know this is an old post but I was just looking for a script to do this and ended up writing my own Powershell script.
This is what I came up with..
Uninstalls "Dell SupportAssist" and "Dell SupportAssist OS Recovery Plugin for Dell Update"
Hope this helps someone else too.. The code probably could be cleaned up or simplified a bit but it worked for me.
$supportassist = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall| Get-ItemProperty | Where-Object {$_.DisplayName -ceq "Dell SupportAssist" } | Select-Object -ExpandProperty UninstallString
if ($supportassist)
{
$arguments = $supportassist.substring(12) + " /qn REBOOT=REALLYSUPRESS"
echo "Uninstalling Dell SupportAsist"
echo "msiexec.exe " $arguments
(Start-Process "msiexec.exe" -ArgumentList $arguments -NoNewWindow -Wait -PassThru).ExitCode
}
$supportassist2 = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall| Get-ItemProperty | Where-Object {$_.DisplayName -ceq "Dell SupportAssist OS Recovery Plugin for Dell Update" } | Select-Object -ExpandProperty UninstallString
if ($supportassist2)
{
$arguments2 = $supportassist2.substring(12) + " /qn"
echo "Uninstalling Dell SupportAssist OS Recovery Plugin for Dell Update"
echo "msiexec.exe " $arguments2
(Start-Process "msiexec.exe" -ArgumentList $arguments2 -NoNewWindow -Wait -PassThru).ExitCode
}
Here is a Powershell script that I currently use to remove it
Param (
[Parameter(Mandatory=$false)]
[switch]$Force = $false,
[Parameter(Mandatory=$false)]
[String] $SoftwareVersion = "3.11"
)
$Software = "Dell SupportAssist"
$ScriptName = $myinvocation.MyCommand
Function Remove-CachedScripts {
$Agent = "C:\Program Files\N-able Technologies\Windows Agent"
if (test-path "C:\Program Files (x86)\N-able Technologies\Windows Agent") {
$Agent = "C:\Program Files (x86)\N-able Technologies\Windows Agent"
}
remove-item "$Agent\cache\$scriptname" -force -erroraction SilentlyContinue
remove-item "$Agent\Temp\Script\$scriptname" -force -ErrorAction SilentlyContinue
}
Function Get-InstalledApp($Target) {
$Apps = #()
$Apps += Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty | Where-Object {$_.DisplayName -eq "$Target" } | Select-Object -Property DisplayName, DisplayVersion, UninstallString
If ($(Get-WmiObject Win32_OperatingSystem).OSArchitecture -match "64") {
$Apps += Get-ChildItem -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty | Where-Object {$_.DisplayName -eq "$Target" } | Select-Object -Property DisplayName, DisplayVersion, UninstallString
}
$Apps
}
Function Uninstall-Software {
if ($SoftwareUninstall -ne $null) {
if (($($SoftwareUninstall.DisplayVersion) -ge "$SoftwareVersion") -and ($force -eq $false)) {
exit 0
}
if ($($SoftwareUninstall.DisplayVersion) -lt "$SoftwareVersion") {
}
ForEach ($item in $SoftwareUninstall) {
if (($item.displayversion -le "$softwareversion") -or ($force -eq $true)) {
If ($item.UninstallString) {
$uninst = $item.UninstallString.Split('/X')[0]
$guid = $item.UninstallString.Split('/X')[2]
$argument = "/x $guid /qn /norestart"
Start-Process $uninst -ArgumentList "$argument" -wait -passthru -NoNewWindow
$Timeout = 0
$MaxWait = 10
While (($CheckSoftware -ne $null) -and ($Timeout -lt $MaxWait)) {
Start-Sleep -Seconds 30
$Timeout++
$CheckSoftware = Get-InstalledApp("$Software")
}
If ($CheckSoftware -eq $null)
{
Exit 0
}
}
}
}
}
}
$SoftwareUninstall = . Get-InstalledApp($software)
. Uninstall-Software
Remove-CachedScripts
Start-Process -FilePath $application.UninstallString -ArgumentList "/q" -Wait -NoNewWindow
Start-Process -FilePath $application.UninstallString -ArgumentList "/s" -Wait -NoNewWindow
Start-Process -FilePath $application.UninstallString -ArgumentList "-q" -Wait -NoNewWindow
I tried to uninstall an application using the above commands, but when I run it the confirm window is prompted, I want to prevent the window from showing.
PoSH simply starts the installer / uninstaller (.msi, .exe). If the installer / uininstaller does not have a silent option, there is nothing PoSH can do about that. The RegKey uninstall string is only calling the original installer used to deploy the application.
See this post for a similar discussion.
How can I uninstall an application using PowerShell?
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}
Other example(s)s:
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/60e06261-f134-41e8-9f99-6bada23a6f02/using-registry-uninstallstring-to-remove-software?forum=winserverpowershell
$javaVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Where-Object {$_.DisplayName -match "java" } |
Select-Object -Property DisplayName, UninstallString
ForEach ($ver in $javaVer) {
If ($ver.UninstallString) {
$uninst = $ver.UninstallString
& cmd /c $uninst /quiet /norestart
}
}
Search for and Uninstall Software on Remote or Local Computer via
Powershell
This script searches for and attempts to uninstall a piece of software
by product name. It queries the SCCM client's WMI class for the
product, finds the uninstall string and executes the uninstall string.
https://gallery.technet.microsoft.com/scriptcenter/Search-for-and-Uninstall-8c2c457e