How can I uninstall an application using PowerShell?

Rob Paterson picture Rob Paterson · Sep 22, 2008 · Viewed 334.3k times · Source

Is there a simple way to hook into the standard 'Add or Remove Programs' functionality using PowerShell to uninstall an existing application? Or to check if the application is installed?

Answer

Jeff Hillman picture Jeff Hillman · Sep 22, 2008
$app = Get-WmiObject -Class Win32_Product | Where-Object { 
    $_.Name -match "Software Name" 
}

$app.Uninstall()

Edit: Rob found another way to do it with the Filter parameter:

$app = Get-WmiObject -Class Win32_Product `
                     -Filter "Name = 'Software Name'"