Search code examples
windowspowershellwindows-installeruninstallation

How can I uninstall an application using PowerShell?


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?


Solution

  • $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'"