Tuesday, October 20, 2009

Automating Application Uninstalls

Update: So instead of just running the string that is listed under UninstallString, add the /quiet /norestart switches. So it should look like this: msiexec.exe /quiet /norestart /x{GUID}

Ok, so I've got a good one now. A couple days ago the need came up to uninstall an application from 15 machines. I checked the switches on the uninstall but unfortuently the manufacturer didn't put in any silent unintall switches. So I began looking into other ways to uninstall an application other than running the executable with a swithc, and I found out this method.

Every application has a GUID assisgned to it. All this information is stored in HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall. You can go through the subfolders to that to find all your applications and all the additional information that goes along with them including the GUID and the uninstall string.

So, here's the idea. You can create a script that query's the Uninstall directory in the registry to look for an applications display name, and then grab the uninstall string. Then take the uninstall string and apply it to a variable, then run the variable. That in turn will launch the uninstaller for that application.

Unfortunately for me my applications uninstall string only launched a manual uninstaller so I can't use it the way I wanted to. However at this point you can see that this could be used in conjunction with SCCM to automatically uninstall applications that end users might install like the weather toolbar and such.

Enjoy

No comments: