Uninstall Software via Powershell

By | June 30, 2020
$Apps = Get-WmiObject win32_product -ComputerName localhost | Out-GridView -PassThru -Title "Select all appliactions to uninstall" -ErrorAction SilentlyContinue
foreach ($App in $Apps){
$returnvalue = $app.uninstall() | Select-Object -Property returnvalue ; $name = $app.name
if($returnvalue.returnvalue -eq "0") 
{write-host "Uninstall was successful $Name" -ForegroundColor Green} 
else{write-host "Uninstall was NOT successful $Name" -ForegroundColor Red} }