1

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.

Clijsters
  • 4,031
  • 1
  • 27
  • 37
Pr Mod
  • 261
  • 2
  • 5
  • 15

2 Answers2

6

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

Pr Mod
  • 261
  • 2
  • 5
  • 15
Jacob
  • 1,182
  • 12
  • 18
  • 1
    Pro tip: If you use forward slashes, it works perfectly well on Windows, and also highlight better on stackOverflow. – Clijsters Aug 12 '18 at 17:17
  • 1
    The first step in this answer produces a hash table and we're asked to find a value from it and manually use that in a second step. This answer could be improved if the first step of the answer was piped through to select the path of the uninstall executable and then that was piped through to perform the uninstall, all in one command or script. – MasterOfNone Jan 23 '19 at 23:59
2

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"

}
Pr Mod
  • 261
  • 2
  • 5
  • 15