Took some fidling, cause it requires the GUID to uninstall, but it has a listing function, so I list them to a text file, then read the text file searching for the name, then grab the GUID and use that. Works perfect (I think, I look forward to testing it on a user with the problem that this fixes)
Private Sub Step1()
Dim FM As New clsFileManager
Dim sCommand As String
Dim sCommand2 As String
Dim bFound As Boolean
Dim iLineNum As Integer
Dim sLineRead As String
Dim sKey As String
Const sMSXMLNAME As String = "MSXML 4.0 SP2 PARSER AND SDK"
Const sCANOSINAME As String = "CANOSISETUP (VERSION 1.0.0)"
'we need some lists of apps to uninstall, first one that has the name
'then one that has the GUID. Once we have the GUID, we can kill it properly.
sCommand = FM.ReadINI(INI, "Network", "Drive", "J:\")
sCommand = sCommand & "cfw32\Workstation Install\UninstallW.exe"
sCommand = Chr(34) & sCommand & Chr(34) 'surround path in quotes
sCommand2 = sCommand 'make copy at this point
'sCommand = sCommand & " /c >C:\cfw32\UninstallCommands.txt"
sCommand2 = sCommand2 & " /l >C:\cfw32\UninstallList.txt"
'now, run the commands
Call Processor.startDeterminedProcessing(0, 50, True, "Building list of uninstalls and their keys, please wait.", False)
frmDeterminedProcessing.Top = frmDeterminedProcessing.Top + 2000
'Call ExecCmd("cmd /C " & sCommand)
Call ExecCmd("cmd /C " & sCommand2)
'Call Processor.StopProcessing
'Now we search thru list 2, and find MSXML (Eventually for CANOSI aswell)
Call FM.OpenFile("C:\cfw32\UninstallList.txt", 1, False)
bFound = False
iLineNum = 0
Do Until FM.isEOF = True Or bFound = True
iLineNum = iLineNum + 1
sLineRead = FM.ReadLine(False)
If InStr(1, UCase$(sLineRead), sMSXMLNAME) Then
bFound = True
End If
Loop
Call FM.CloseFile(False)
'we got it, dbug the line number
Call dbug("Found MSXML, line number is: " & iLineNum)
'Parse the key out of it, it is indicated by the brackets
sKey = Left(sLineRead, InStr(1, sLineRead, "}"))
Call dbug("Key found is: " & sKey)
'Ok we got it, kill it
Call Processor.setMessage("Uninstalling " & sMSXMLNAME)
'Call Processor.startDeterminedProcessing(0, 50, True, "Uninstalling " & sMSXMLNAME, False)
'Call ExecCmd("cmd /C " & sCommand)
Call ExecCmd("cmd /C " & sCommand & " /q " & sKey)