Kaseya Community

Uninstalling Applications with Varying Version Numbers

This question is not answered

I initially was using the MsiExec.exe command to remove applications using the GUID.

This meant getting the GUID from many machines that have different versions of the program installed.

So I discovered that the powershell method of using the Product Name was more effective.

Ex: (Get-WmiObject -Class Win32_Product -Filter "Name='PRODUCTNAME'" -ComputerName . ).Uninstall()

However, some programs I need to remove have "version xxx" or "(1.0.xxx)" after the PRODUCTNAME.

I haven't been successful with trying to add a wildcard to the end of the product name.

So my question is how do you write a procedure that allows you to remotely uninstall any version or a program without having to gather GUIDs?

All Replies
  • I believe WMI has a LIKE operator, so you can probably do something like:

    (Get-WmiObject -Class Win32_Product -Filter "Name LIKE 'PRODUCTNAME%'" -ComputerName . ).Uninstall()


    Note: You may also have to iterate on each returned object, as you could get a list of more than one match. In other words:

    gwmi -Class Win32_Product -Filter "Name LIKE 'PRODUCTNAME%'" | foreach {$_.Uninstall()}


    Added note about iteration in case multiple results are returned.
    [edited by: nate-pgn at 10:03 AM (GMT -7) on Oct 18, 2017]
  • For anyone else arriving here looking for a non-Powershell solution, you can also do the same through native Windows commands:

    wmic product where (name like '%productname%') call uninstall /nointeractive