I recently ran into a situation where I needed to uninstall Microsoft Office Live Meeting 2007 through SCCM. Normally this would not be an issue, but the environment I was working had multiple versions installed. Therefore I was unable to run the msiexec /x {product code} command, because each version had it own product code.
This left me with a couple of options. I could make a separate uninstall for each version. This would be very cumbersome and require being able to determine the product code for every potentially installed version. Or I could write a VBScript that would find the installed version and perform the uninstall. I choose to create the VBScript.
Even though each version has its own product code, they all contain the same upgrade code. So, using the upgrade code I was able to write a script that will query the Win32_Property class and return the product code based on the upgrade code. The script will then execute the msiexec /x {product code} command to perform the uninstall.
I have tested this with four different versions and it worked for each of them. The good thing about this, is you can use this for pretty much any product that uses the upgrade code in the install MSI. You will just need to change the upgrade code in line 13.
strComputer = "."
Set WshShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
On Error Resume Next
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Property Where Property = 'UpgradeCode'")
For Each objSoftware in colSoftware
'Check for Microsoft Office Live Meeting 2007 - Uninstall if found
If objSoftware.Value = "{574BB76B-6E89-497C-906F-2CBB7EC6ABB9}" Then
strCMD = "MsiExec.exe /x " & objSoftware.ProductCode & " /qn"
objExec = WshShell.Run(strCMD,1,True)
If objExec <> 0 Then
WScript.Quit objExec
End If
End If
Next
WScript.Quit 0
This script can easily be changed to add logging and additional error checking as needed.