How to Uninstall a program for the command line

17 Mar

Today I was trying to remove some software from a Hyper-V Server 2008 R2 box, and obviously it has no nice little Add/Remove Programs GUI to use.

It can still be done however. First, call ‘MWIC’ from the command line.

c:\>MWIC

This will take you to this prompt:

wmic:root\cli>

Here you need to enter ‘product get name’:

wmic:root\cli>product get name

This will list all the applications that are installed on that machine.

From the list that is returned, find the name of the application that you wish to remove and then type:

product where name=”application name” call uninstall

Assuming the application name matches an application that is already installed, you will then be promted with the old ‘Are you sure? Enter Y/N to continue’.

Enter ‘Y’ and all going well, it will uninstall and return ‘Method Execution Successful’. You can then call ‘product get name’ again to check what programs are now installed on the box.