How do I uninstall a program from Add or Remove Programs using Deployment Server?

book

Article ID: 181402

calendar_today

Updated On:

Products

Deployment Solution

Issue/Introduction

 

Resolution

Question
How do I uninstall a registered program in Add or Remove Programs using a Deployment Server job?

Answer
All programs registered in Add or Remove Programs on a Windows operating system have the ability to be removed from a script. The registry on the client machine will show the syntax needed to remove that particular program. Once the syntax has been found, it can be entered into a "Run Script" job and then it can be deployed to multiple machines.

The following registry key contains all information about Windows Add or Remove Programs:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

If you browse to this registry key in the Regedit program, you should see a registry key for every program installed and registered there. Under each item, it should have a "DisplayName" and also an entry for "UninstallString." If you can find the correct entry by verifying that the Display Name is the correct item that you want to uninstall, then you should be able to copy out the Uninstall String, put that into a .bat file, and then run that batch file to uninstall that program.

This uninstall might not be silent, and additional command line parameters might need to be added to make the uninstall completely silent. If the uninstall is using MsiExec.exe then you can change the /L switch to a /x switch, and also add an additional /q switch to the end of the string.

The following is an example:

I am managing a group of computers through the Deployment Server, and I want to uninstall Adobe Acrobat Reader 7.0 from this group of the client machines that I am managing. I go to one of the client machines and go to Start, then Run, and then type in "regedit". I browse out to the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

I then browse through the various subkeys until I find the key {AC76BA86-7AD7-1033-7B44-A70000000000}. I select that key, and the DisplayName is "Adobe Reader 7.0". The UninstallString is

MsiExec.exe /I{AC76BA86-7AD7-1033-7B44-A70000000000}

I copy out the uninstall string and I paste it into a command prompt window. When I run this, I notice that it is prompting for more information. I want to make this silent, and I want to make sure that it gets uninstalled (instead of repaired or reinstalled). Because this command is using MsiExec.exe I change the "/I" to a "/x" to uninstall the program, and I add a "/q" to the end of the command to make it silent. When I am finished I have the following string:

MsiExec.exe /x{AC76BA86-7AD7-1033-7B44-A70000000000} /q

When I run this manually from a command prompt on a client machine that has Adobe Acrobat Reader 7.0, I notice that it in fact does uninstall the program silently. I then go back to my Deployment Server, and I create a new job called "Uninstall Adobe Acrobat Reader 7.0". I add a Run Script task, and have it run in Windows on the client machine. I then put in the following line into that script:

MsiExec.exe /x{AC76BA86-7AD7-1033-7B44-A70000000000} /q

I click on Next, and then Finish. When the job is created and finished, I schedule the job on another test client machine, and I verify that it does work correctly. I then schedule the job on all of my client machines that need Adobe Reader removed.