uninstall multiple versions of software
What is the command line syntax to uninstall multiple msi packages at the same time?
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
aogilmor
15 years ago
Posted by:
SMSPMP
15 years ago
Here is a vbs script I use to remove multiple versions of Quicktime. I have also used this on many other applications such as Java too. All you need is the PID's of the applications you want to put into the Array. The script runs through the Array with the associated PID's and if it matches, uninstalls the app. I push this script out with SMS and have a very good success rate with it.
Call Main
Sub Main()
On Error Resume Next
Call RemoveQuicktime
End Sub
Sub RemoveQuicktime()
On Error Resume Next
Set oShell = WScript.CreateObject("WScript.Shell")
' F07B861C-72B9-40A4-8B1A-AAED4C06A7E8 /7.1.3.100
' 929408E6-D265-4174-805F-81D1D914E2A4 /7.0.4
' C21D5524-A970-42FA-AC8A-59B8C7CDCA31 /7.1
' 55BF0E5F-EA8E-4C13-A8B4-9E4857F5A2DE /7.1.3.130
' 50D8FFDD-90CD-4859-841F-AA1961C7767A /7.1.3.170
' 5E863175-E85D-44A6-8968-82507D34AE7F /7.1.5.120
Dim QTClassID
QTClassID = Array("F07B861C-72B9-40A4-8B1A-AAED4C06A7E8", _
"929408E6-D265-4174-805F-81D1D914E2A4", _
"C21D5524-A970-42FA-AC8A-59B8C7CDCA31", _
"55BF0E5F-EA8E-4C13-A8B4-9E4857F5A2DE", _
"50D8FFDD-90CD-4859-841F-AA1961C7767A", _
"5E863175-E85D-44A6-8968-82507D34AE7F")
For Count = LBound(QTClassID) to UBound(QTClassID)
sKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{" & QTClassID(Count) & "}"
If RegKeyExists(sKeyPath) Then
sQTunInstall = "msiexec.exe /X{" & QTClassID(Count) & "} /qn REBOOT=ReallySuppress"
oShell.Run sQTunInstall,,True
End If
Next
Set oShell = Nothing
End Sub
Function RegKeyExists(strRegKey)
Const HKLM = &H80000002
strRegKey = Trim(strRegKey)
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
If objReg.EnumValues(HKLM, strRegKey, aValueNames, aValueTypes) = 0 Then
RegKeyExists = True
Else
RegKeyExists = False
End If
Set objReg = Nothing
End Function
Call Main
Sub Main()
On Error Resume Next
Call RemoveQuicktime
End Sub
Sub RemoveQuicktime()
On Error Resume Next
Set oShell = WScript.CreateObject("WScript.Shell")
' F07B861C-72B9-40A4-8B1A-AAED4C06A7E8 /7.1.3.100
' 929408E6-D265-4174-805F-81D1D914E2A4 /7.0.4
' C21D5524-A970-42FA-AC8A-59B8C7CDCA31 /7.1
' 55BF0E5F-EA8E-4C13-A8B4-9E4857F5A2DE /7.1.3.130
' 50D8FFDD-90CD-4859-841F-AA1961C7767A /7.1.3.170
' 5E863175-E85D-44A6-8968-82507D34AE7F /7.1.5.120
Dim QTClassID
QTClassID = Array("F07B861C-72B9-40A4-8B1A-AAED4C06A7E8", _
"929408E6-D265-4174-805F-81D1D914E2A4", _
"C21D5524-A970-42FA-AC8A-59B8C7CDCA31", _
"55BF0E5F-EA8E-4C13-A8B4-9E4857F5A2DE", _
"50D8FFDD-90CD-4859-841F-AA1961C7767A", _
"5E863175-E85D-44A6-8968-82507D34AE7F")
For Count = LBound(QTClassID) to UBound(QTClassID)
sKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{" & QTClassID(Count) & "}"
If RegKeyExists(sKeyPath) Then
sQTunInstall = "msiexec.exe /X{" & QTClassID(Count) & "} /qn REBOOT=ReallySuppress"
oShell.Run sQTunInstall,,True
End If
Next
Set oShell = Nothing
End Sub
Function RegKeyExists(strRegKey)
Const HKLM = &H80000002
strRegKey = Trim(strRegKey)
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
If objReg.EnumValues(HKLM, strRegKey, aValueNames, aValueTypes) = 0 Then
RegKeyExists = True
Else
RegKeyExists = False
End If
Set objReg = Nothing
End Function
Comments:
-
How would you code
"C:\Program Files\Google\Google Toolbar\Component\GoogleToolbarManager_F91D44FAA5479127.exe" /uninstall &
regsvr32 /u /s "c:\program files\google\googletoolbar3.dll"
into your script - Kdebiasse 11 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.