PowerShell for Windows Admins

Jul 16 2010   6:59AM GMT

Uninstalling software

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

The Win32_Product class can be used to list the installed software (what shows in Control panel Programmes and Featurs) on a machine.  it can also be used to uninstall software.

We can see the installed software

Get-WmiObject -Class Win32_Product

we can filter down to the results we need

Get-WmiObject -Class Win32_Product -Filter “Name LIKE ‘%TechNet%'”

The specific version to uninstall is selected

$t = Get-WmiObject -Class Win32_Product -Filter “Name = ‘TechNet Library – English DVD (March 2010)'”

and then we call the uninstall method

$t.Uninstall()

A return code of zero indicates a successful uninstall. Anything else and we have problems.

This method doesn’t delete items from the start menu – which is a job for another time

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: