Thursday, April 22, 2010

Windows Uninstall Using the Command Line

I ran across this website while trying to figure out how to uninstall programs from windows computers without using the add/remove program feature in Control Panel.

I like the idea of using the WMIC Windows Management Instrumentation Command. It is clean and relative easy to work with.

I did have a few problems, one of which is that for me it worked best to run wmic as the local or domain administrator.

To be able to run wmic as administrator on a machine, I used psexec from the Microsoft PS Tools and loaded them on a share drive. More about PS Tools can be found here
http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

I created a quick batch file that I ran.

#output a text file that lists currently installed software
\\server\share\pstools\psexec \\%computername% -u DOMAIN\administrator -p password -i -c -f wmic /output:c:\beforeuninstall.log product get name

#uninstall routine for AutoCad 2010
\\server\share\pstools\psexec \\%computername% -u DOMAIN\administrator -p password -i -c -f wmic product "AutoCAD 2010 - English" call uninstall /nointeractive

Unsure if this works with Windows Vista or Windows 7.

No comments:

Post a Comment