Wednesday, April 7, 2010

Scripting an uninstall of any Windows program

Something I’ve had to figure out for a script to uninstall any version of the Citrix client without prompting the user is to find how to uninstall any specific program.

This is saved in the registry for every installed program and the string for a program from one PC should work on any PC – providing its the same version of the program. 

Open Regedit and go to this location:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

Below this location are lots of folders with GUID names – press CTRL-F and type something from the name of the product you need the uninstall line for.  It should jump to the right folder (check it has!) and then look for the value “UninstallString”.  The contents of this are what you are after.  Mostly this will start msiexec.exe…

You might well want to edit it before you include it in a script – for instance on an MsiExec.exe command adding the switches “REBOOT=ReallySuppress /qb!-“ will suppress a reboot and make it completely non-interactive, so the user just sees a brief status bar as it uninstalls.  Without it, it might prompt for uninstall or a reboot.

image

No comments:

Post a Comment