How to uninstall all versions of a particular piece of software.

We’re in the mist of doing an Adobe Acrobat Reader upgrade, and one of my co-workers found this place of code on the net.  The vbscript loops though WMI’s Win32_Product, calling the Uninstall method for each matching product name.
(in the script below, obviously we’re uninstalling Acrobat Reader).

Note: the software must have been installed using Microsoft MSI, for it to be uninstallable via this script.

'============================================
Function Uninstall_Any()
    On Error Resume Next
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product Where Name LIKE 'Adobe Reader%'")
    For Each objSoftware In colSoftware
        objSoftware.Uninstall()
    Next
End Function

‘Program starts here
‘=====================
Call Uninstall_Any()

Reference(s):
Microsoft MSDN: WMI Tasks – Computer Software