Although it applies to any installation package, not just IDS, the next really useful skill I’ve picked up is performing a silent uninstall. In the case of my deployment, I would like to uninstall certain applications if they exist (Civil 3D 2010, LDT 2009 Companion, and Raster Design 2010). Figuring out the right command with the right switches to uninstall a specific program has historically been very challenging, until I met my new best friend AppDeploy.com. Here you can take advantage of the kind folks who provided uninstall codes for lots and lots of different applications. There’s no guarantee you’ll get the right one the first time but at least it narrows it down. For example, I searched Raster Design 2010 and got this:
There are two codes listed here and lucky me!…the first one worked. I had to doctor it up a bit by adding a /x and /quiet switches and also an IF statement that checked for a file to see if RD was even installed. After that, I just added this line to the beginning of my batch file and Raster Design be gone!
IF Exist "C:\Program Files (x86)\AutoCAD Raster Design 2010\acgiclipengine18.dll" Call MsiExec.exe /x{9E92FE3D-E224-0409-0002-69EA414E8E51} /quiet
Got a more eloquent way to silently uninstall program X, please share!
I don’t think you need the “IF Exist … Call ” part. If msiexec.exe doesn’t find the package it will just skip over it. You may want to consider a VB script with a run function. VB scripts will give you a lot more flexibility than a batch file.
Set oWSH = CreateObject(“WScript.Shell”)
strAppPath = WScript.ScriptFullName
strAppPath = Left(strAppPath, InStrRev(strAppPath, “\”))
Run strAppPath & “setup1.exe”
Run strAppPath & “setup2.exe”
Run strAppPath & “setup3.exe”
Sub Run (sRunString)
Set oExec = oWSH.Exec(sRunString)
Do While oExec.Status = 0
WScript.Sleep 100
Loop
Select Case oExec.ExitCode
Case 0
‘ success
WScript.Sleep 10
Case 1605
‘ product is not installed (error when trying to uninstall)
WScript.Sleep 10
Case 3010
‘ success, reboot required
WScript.Sleep 10
Case Else
‘ failed
WScript.Sleep 30000
WScript.Quit oExec.ExitCode
End Select
End Sub