Uninstall 5 Programs
-
Tuesday, June 19, 2012 6:54 PMIs there a way through PowerShell to uninstall 5 programs without having to be present. I am going to have to do this on at least sixty machines and instead of going through the un-installation process, is there a way to do this by building a simple script and then applying it on all sixty machines?
All Replies
-
Tuesday, June 19, 2012 9:46 PM
Ed Wilson has several articles to this effect. Here is a good primer in using the WMI classes/methods to remove software.
- Proposed As Answer by Stephen Correia - tumtum73 Sunday, June 24, 2012 3:12 PM
-
Wednesday, June 20, 2012 4:52 AMModerator
Hi,
$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "Software Name" } $app.Uninstall()Regards,
Yan Li
Yan Li
TechNet Community Support
- Marked As Answer by Yan Li_Microsoft Contingent Staff, Moderator Friday, June 29, 2012 9:17 AM
-
Thursday, June 21, 2012 9:53 PMYeah, that'll uninstall one, but will that install five in a row if I separate them by a comma?
-
Thursday, June 21, 2012 9:59 PM
-match is a regular expression operator, so, depending on how your write it, yes, it could work. Another approach would be to pass it as an array with foreach:
'app1','app2','app3','app4','app5' | % {
$name = $_;
$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match $name } $app.Uninstall()
}
- Proposed As Answer by Yan Li_Microsoft Contingent Staff, Moderator Friday, June 22, 2012 2:40 AM
- Marked As Answer by Yan Li_Microsoft Contingent Staff, Moderator Friday, June 29, 2012 9:17 AM

