简体   繁体   中英

Uninstall a exe software using powershell

I am following this thread to uninstall mozilla firefox from my Windows 10 systems.

I have installed mozilla firefox originally with an exe installer and I don't get a mozilla entry executing gwmi -Class Win32_Product .

Is there any way I can trigger the uninstaller for that software on my windows system?

Note: I wont be able to use msi installer for this purpose.

If you run

Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ | ? { $_ -match "Firefox" }

It shows the UninstallString as:

C:\\Program Files (x86)\\Mozilla Firefox\\uninstall\\helper.exe

You should be able to run this to remove Firefox. Use the /s switch to run a silent uninstall.

Something along the lines of:

'"C:\\Program Files (x86)\\Mozilla Firefox\\uninstall\\helper.exe /s"' | cmd

Adding modified working code with architecture diff

$x86App  = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*' | ? { $_ -match "Firefox" }

$x64App = Get-ChildItem 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' | ? { $_ -match "Firefox" }

if ($x86App)
{
$UninstallPath = ($x86App |Get-ItemProperty).UninstallString
Start-Process -NoNewWindow -FilePath $UninstallPath -ArgumentList " /s"
}

elseif($x64App)
{
$UninstallPath = ($x64App |Get-ItemProperty).UninstallString
Start-Process -NoNewWindow -FilePath $UninstallPath -ArgumentList " /s"

}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM