I have a PowerShell that would uninstall a program from remote computers but it takes a long time since it goes through all the computers in the list. I just need help from you to modify it so it first checks if the program exists on the remote computer or not and then uninstalls it:
$comps = gc "C:\Computers.txt"
$appname = gc "C:\appname.txt"
foreach($comp in $comps){
foreach ($appname in $appname){
$prod=gwmi -computer $comp win32_product | ?{$_.name -eq "$appname"}
$prod.uninstall()
}
}
Got it! thanks