Uninstalling a program from Add or Remove programs in XP

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
jiby
Junior Coder
Posts: 30
Joined: Fri Feb 26, 2010 12:26 pm

Uninstalling a program from Add or Remove programs in XP

Post by jiby » Tue Jun 15, 2010 7:12 am

hello,

OS: XP Service Pack 2

I am trying to uninstall .NET framework named "Microsoft .NET Framework 3.5" from 'Add or Remove Programs' using script. I am not able to identify its location exactly in that list. Please tell if there is anyway to identify that program from that window and click 'Remove'.

Thanks
jiby.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

uninstal programs by command line using wmic

Post by adroege » Tue Jun 15, 2010 12:27 pm

I would use the technique described here instead.


http://www.tech-recipes.com/rx/2947/win ... mand_line/


By using the Windows Instrumentation command-line interface (WMIC), you can easily uninstall an application without having to use the GUI. Once you become familiar with the steps, it will be much faster than having to access the Add/Remove Programs applet in the Control Panel. This Tech-Recipe applies to Windows XP Professional, Windows Vista, Windows Server 2003 and Windows Server 2008.


1. Open a command prompt.

2. Input WMIC and press Return. You will see a prompt that looks like this:
wmic:root\cli>

3. At the new prompt, execute the following command:
product get name

This will generate a list of installed applications.

4. At the prompt, execute the following command:
product where name="" call uninstall

where application name is the name of the program you wish to uninstall (use the exact name provided by the previously generated list).

For example, if I were wanting to uninstall Adobe Reader 9, my command would look like this:
product where name="Adobe Reader 9" call uninstall

5. When prompted, input y to confirm that you wish to uninstall the application and press Return.

The application will be uninstalled.

jiby
Junior Coder
Posts: 30
Joined: Fri Feb 26, 2010 12:26 pm

Post by jiby » Tue Jun 15, 2010 1:39 pm

Thanks adroege.

But I am not seeing all the installed applications using WMIC's 'product get name'. I have 'NVIDIA drivers' which are not getting showed up in WMIC. I like to get the generic solution for this. Please help me in this regards.

Thanks
jiby

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Tue Jun 15, 2010 2:11 pm

Here is another solution I found here:
http://www.experts-exchange.com/Operati ... 12705.html
Not always, but most programs can be uninstalled via the command line.

Open regedit.exe and open the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Beneath this key are all the entries that can be uninstalled (some of them have a guid instead of a recognizable name, but you can probably find out the correct entry by using the Find command in the Edit menu).
Open the key of the entry you want to uninstall. You will see an entry called UninstallString. Copy the value of this entry to the command line and run it.

Your program should uninstall now.

Hope this helps.
Automating using the GUI is difficult. The list might be long and you would need to scroll the list, You might need image recognition, etc... I don't know if a completely generic "always works" solution is possible. I believe the best you can hope for is a solution to your specific problem - verifiable by trial and error (testing).

jiby
Junior Coder
Posts: 30
Joined: Fri Feb 26, 2010 12:26 pm

Post by jiby » Thu Jun 17, 2010 6:29 am

Thanks adroege, this worked.

I just executed the text that is present in "UninstallString" of the registry and it got uninstalled.

-jiby

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts