Programmatically uninstall, installed from Group Policy MSI
Posted: Wed Jan 28, 2009 3:56 pm
This is sort of long, but hopefully somebody can shed some light...
Does anybody know how I can determine programmatically whether my app was installed using the compressed .exe or if it was installed using an MSI created by the Group Policy Wizard?
I'm having trouble removing the previous version during an upgrade if it was installed using the GP MSI, because it looks like the add/remove programs information for my product is different if I install using an MSI created with the Group Policy Wizard than if I install using the compressed setup EXE. This is because the ARP registry information is different between the two.
If I install using the EXE, I get two registry keys full of info:
I'm not sure why there are two entries, and I can't tell which ARP is using. My installer adds NoModify, NoRemove, and NoRepair values to the $TITLE$ key, but these values show up in the $PRODUCTCODE$ one as well even though I'm not putting them there specifically.
When performing an upgrade, I read the value
into a variable, $OLDINSTALLER$, then uninstall the old one during prerequisite processing by calling:
This works great, but if the old version was installed with the MSI from Group Policy, $OLDINSTALLER$ is blank. This is because that registry value does not exist. Instead, if I install using the Group Policy MSI, I get the two registry keys mentioned above as well as a third:
In this case, the only registry key under "Uninstall" that has an "UninstallString" value for my product is the third one with a GUID that means nothing in the context of my project. Furthermore, this UninstallString is an msiexec call to uninstall the GUID that has nothing to do with my application and not the setup.exe file that was archived for later uninstallation.
I guess the simple way of summing all this up with by asking, "How can I programmatically uninstall my application if it was installed using a Group Policy MSI?"
Thanks for reading!
Does anybody know how I can determine programmatically whether my app was installed using the compressed .exe or if it was installed using an MSI created by the Group Policy Wizard?
I'm having trouble removing the previous version during an upgrade if it was installed using the GP MSI, because it looks like the add/remove programs information for my product is different if I install using an MSI created with the Group Policy Wizard than if I install using the compressed setup EXE. This is because the ARP registry information is different between the two.
If I install using the EXE, I get two registry keys full of info:
Code: Select all
HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$TITLE$
and
HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$When performing an upgrade, I read the value
Code: Select all
HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallStringCode: Select all
Run Program $OLDINSTALLER$ /s REMOVE=TRUE MODIFY=FALSE REPAIR=FALSE (WAIT)Code: Select all
HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{SOME-GUID-THAT-HAS-NOTHING-APPARENT-TO-DO-WITH-MY-PROJECT}I guess the simple way of summing all this up with by asking, "How can I programmatically uninstall my application if it was installed using a Group Policy MSI?"
Thanks for reading!