TransWikia.com

Uninstall set of programs using Powershell

Super User Asked on November 9, 2021

I have a set of programs I would like to uninstall with Powershell.

Get-WmiObject Win32_Product | where-Object {$_.name -Like "MySQL*"}

How do I pipe this to an uninstall function?

Some questions seems to use msiexec, but others recommend .uninstall()?

One Answer

You could take the existing output and call Uninstall() for each product:

Get-WmiObject Win32_Product | where-Object {$_.name -Like "MySQL*"} | ForEach-Object { $_.Uninstall() }

Just be very sure you want to uninstall every product starting with "MySQL".

It should also be quicker if you do your filtering from the WMI query:

Get-WmiObject Win32_Product -Filter "name LIKE 'MySQL%'" | ForEach-Object { $_.Uninstall() }

Answered by Luke Humberdross on November 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP