Anders G. Nordby

Lead Consultant at Itera

Monthly Archives: September 2013

Easily Remove Several Programs at Once

Installers often install several programs at once. If we go to Control Panel and Uninstall a program (I’m using Windows 7 at the moment), we’ll see a whole list instead of a single item. E.g. looking at the Adobe Flash Player, I find two entries:

uninstall1

For other kinds of software, the list may of course be much longer. If I decide that I want to remove these items, with the GUI that is provided by Windows I’ll have to right-click each one of these, choose Uninstall, and then wait for it to finish before I can select the next one. This soon becomes tiresome if I want to remove Microsoft SQL Server, Microsoft Visual Studio, or some other application that has a lot of entries here. Well, PowerShell comes to the rescue!

This little example will remove both of the Adobe Flash Player entries shown above:

$apps = Get-WmiObject -Class win32_product | where -property name -Like "*Flash Player*"
foreach ($app in $apps) { $app.uninstall() }

See how easy that was? Before you run the second line, you might of course inspect what you have in $apps, e.g. the names of the applications. (I’m just posting this here because I think uninstalling stuff might be something I’ll need in the future…)

Advertisements