Uninstalling Program

Uninstalling software (ArcFM) with powershell with no Remove option in MSI

In a previous life, I used a fun product called PDQ to manage application deployments. One of the cool features of the product was that it pulled Product GUIDs for installed applications and built uninstallers for them. Here's how it did it:

# GUID is not unique across multiple computers, so pull it from the machine
$gui = Get-WMIObject Win32_Product | Where-Object -Property name -like "ArcFM*" | Select-Object -ExpandProperty IdentifyingNumber
# Use MSIexec.exe /x = uninstall /QN = silent
msiexec /x $guid

Hopefully that helps!

UPDATE
I am editing the answer so that I can accept it. Removing th e /QN parameter from the final command. Placing it after the $guid variable may work too.

After using msiexec to uninstall a program it remains in the control panel (add/remove programs)

The Actual Solution (after debugging):

Run: C:\ProgramData\Package Cache{Product-GUID}\ProductSetup.exe /uninstall /quiet


Duplicate Installation: You probably have a duplicate installation. Unless you accidentally left the Add / Remove Programs applet open during uninstall in which case you should close and reopen it to verify that the entry is still present.

"Noise": You could also have an issue with too many packages present to see that your setup.exe has installed as two separate MSI
files. To prevent this, test on a clean virtual and check the Add /
Remove Programs list well for other, related entries.

Product Code: You can find the product codes and product names for all products installed by using one of the methods described here:
How can I find the product GUID of an installed MSI setup? Maybe try the PowerShell one-liner, or the VBScript.

Rollback: Note that an MSI can rollback its uninstall if a custom action fails during uninstall. This means that the rollback
becomes a re-install or at least a recovery of the files that the
uninstall removed. So in this scenario it looks like the uninstall ran, but the product was recovered due to a failing custom action. So the uninstall never "committed".

Uninstall: And here are several ways to uninstall MSI packages: Uninstalling an MSI file from the command line without using msiexec. When you have uninstalled all entries I would expect the ARP entry to be gone. Is this your own package? Duplicate installations are very common in such cases as a by-product of rapid test cycles.


Packed GUIDs: The GUIDs you find in the registry are generally packed, or in other words not formatted the same way as in your MSI.

Sample GUID Conversion:

HKEY_CLASSES_ROOT\Installer\Products

Packed GUID: 0076C0A639AEC2738817CDFC311D064A
Normal GUID: {6A0C6700-EA93-372C-8871-DCCF13D160A4}

Here are more details:

  • What is a compressed GUID and why is it used?
  • MSIEXEC -Embedding

The latter link has a VBScript to convert Packed GUIDs to normal GUIDs.


LocalPackage: There is a local package cached on all systems when an MSI is installed. It will be located in %SystemRoot%\Installer. You can use this to locate the file, and you can then right click it in Windows Explorer and select "Uninstall".

The idea here is not to use this as your main approach, but to
determine if there is a hidden MSI that you also need to uninstall to
get rid of everything from ARP.

Here is a VBScript to show the LocalPackage path (create VB script file on desktop, save and double click. Look for output msiinfo.csv - double click and import to Excel or equivalent - or notepad):

' Retrieve all ProductCodes (with ProductName and ProductVersion)
Set fso = CreateObject("Scripting.FileSystemObject")
Set output = fso.CreateTextFile("msiinfo.csv", True, True)
Set installer = CreateObject("WindowsInstaller.Installer")

output.writeline ("Product Code,Product Name,Product Version,Local Package")

On Error Resume Next ' we ignore all errors

For Each product In installer.ProductsEx("", "", 7)
productcode = product.ProductCode
name = product.InstallProperty("ProductName")
version=product.InstallProperty("VersionString")

local=product.InstallProperty("LocalPackage")

output.writeline (productcode & ", " & name & ", " & version & ", " & local)
Next

output.Close

Similar Answers:

  • WiX/MSI installer successfully runs for uninstalling an app but the app has not been uninstalled

How can I install a program, so that I can completely uninstall it later?

The short answer is that you can't. Even a "perfect" uninstaller will leave some registry entries behind. These are cache and tracking entries made by Explorer and their size is negligible.

If you want to attempt to cleanly uninstall you must keep track of the changes made to the system.

Stop all other running programs. Use a tool like RegShot or RegistryChangesView to take a snapshot. Then install and run and then exit the installed application. Now take the 2nd registry snapshot. To track installed files you can use Process Monitor.

After uninstalling you would then manually inspect the system to make sure all traces are gone by comparing with the install logs you made. Keep in mind that some 3rd-party libraries (VC run-time, .net) might have to stay behind if other applications you installed later require them.

You could look at some of the 3rd-party uninstall applications, some of them claim to track and/or perform cleanup.

CCleaner and other such tools might also help.

A file just sitting there on your hard-disk does not use memory. Registry entries do however have a memory impact.

Add application to uninstall or change a program

1.Use Registry Editor (Regedit.exe) to view the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

2.Double-click the UninstallString registry value, copy the contents of the Value Data box by selecting the contents and pressing CTRL+C, and then quit Registry Editor.

3.Click Start, click Run, press CTRL+V to paste the uninstall command, and then click OK.

Some programs create a folder under the Winnt folder that contains a "$" character at the start and end of the folder name. This folder may contain an uninstall program that you can run to remove the program you previously installed on your computer. Note that these folders are usually hidden, and that you may need to configure Windows Explorer to view hidden files and folders. To do so, right-click Start, click Explore, click Options on the View menu, and then click Show all files.



Related Topics



Leave a reply



Submit