is there an universal line to delete/uninstall any application that is shown in control panel? preferably PowerShell but can be another language. I have lines that delete .msi not .EXE. this part has been quite difficult, I am not knowledgeable in differences between .EXE and .MSI, if anyone has any idea how I could differentiate them so I could at least get .msi solved
here is the code I se for .msi
$ComputerName = Read-Host -Prompt 'Input the computer name' # the name of the computer to remove the app from
Get-WmiObject Win32_Product -ComputerName $ComputerName | Select-Object -Property Name | Out-GridView -Title "All apps on destination Computer"
$Name = Read-Host -Prompt 'Input name of the application (has to be exact name)' #name of the application
$Application = Get-WmiObject Win32_Product -ComputerName $ComputerName | Where-Object {$_.Name -eq $Name} #choose the object, this will be the app that we will delete
if ($Application) {
$Application.Uninstall()
"
The removal was successful"
}
else {
$Name + ' is not installed on ' + $ComputerName
}
Start-Sleep -Seconds 10