2

I have a pc that I use for testing things that I frequently wipe and re-install using the restore cd that came with it. Unfortunately, the install cd puts a lot of junk on the machine. Sometimes I just live with it, since I know I'll be wiping soon again anyway, but I really want to be able to remove this junk in a simple way. My long term solution is to be able to use a virtual machine instead, but that's not an option right now.

So what I want to is put together a small batch file (or even vbs script) to uninstall this stuff that I can run after a restore. It's the same set of programs each time, so tailoring the script to the programs is not a problem.

What is a problem is finding the uninstall programs for some of this junk. In several cases, the only way I can find to uninstall them is via the Add/Remove programs entry in the control panel. So what I'm looking for is a way to pull that in from the control panel in my script/batch file. Any suggestions appreciated.

3
  • I did consider asking this on StackOverflow because it's for a script, but I have a strong suspicion that if I asked there it would be moved here, because it's really more a systems administration/windows issue as well. Feb 24, 2010 at 15:31
  • Out of curiosity why isn't the virtual machine an option? It would probably work nicely if you have a white box that is capable of running VMWare ESXi. Feb 24, 2010 at 15:41
  • Two reasons: 1) licensing -- I don't want to buy an extra xp license for the host and I don't want to install a linux host. 2) performance -- It's an older machine that would definitely suffer for the extra layer of software Feb 24, 2010 at 15:46

2 Answers 2

5

Wmic Command

  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.

source: tech-receipes

You could call the command directly: wmic product where name="" call uninstall /interactive:off

MSDN about the wmic command

The PC Decrapifier

A program designed to remove or uninstall a specific list of unwanted software in an unattended fashion. It can be used to clean off most of the annoying software that is typically shipped with new PCs.

The commercial version has the additional ability to automate itself. If you would like to include the PC Decrapifier in another script, you can pass additional parameters on the command line.

Tarma Uninstall

Uninstalls a program from the command line (i.e., without going through the Add/Remove Programs control panel). It can also list information about installed programs. This program can be used in batch files and as a custom action in installers.

3
  • The wmic command didn't work as well as I would have hoped. I still have to remove some things manually and others were only half removed. But I was able to remove a few of the items like this. Feb 25, 2010 at 4:11
  • When I try this command, it prompts me to type Y or N to uninstall. Is there anyway to get rid of the prompt? I am using the /interactive:off option too, but it still is prompting me. Jun 2, 2011 at 17:07
  • 1
    Figured it out, you have to use /nointeractive instead of /interactive:off Jun 2, 2011 at 17:22
0

Why don't you just tidy up a fresh system restore and then clone the disk yourself (e.g. with EASEUS ToDo Backup). Even if you can automate the cleanup process, it will take significantly longer to restore a system from DVD and remove the junk than deploying a clean disk image.

Or even better, since this is Windows XP, most restore disks contain the installation source, usually in a folder called i386, just create your own XP installation disk and install XP clean from scratch and then clone the disk. no matter how automated your uninstaller script, there will still be a ton of junk files and orphaned registry entries left.

Here's a tutorial for you:

How to Create a Bootable Windows XP Setup Disk on a Preinstalled / Preloaded Windows System

1
  • I considered that, and it's a good idea. But I think this time I really want to build script to clean up the junk. Feb 24, 2010 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .