uninstall Products in order
Hi,
I have to uninstall many products one after one and to respect an order. How can i do this en command line
3 Comments
[ + ] Show comments
-
What deployment tool are you using? You should take advantage of that instead of using a batch file. - rileyz 10 years ago
-
i'm using sccm to deploy my application - Asker 10 years ago
-
So build a Task Sequence. Although these were designed for OS deployment, they're ideal for this kind of thing. - anonymous_9363 10 years ago
Answers (2)
Answer Summary:
Please log in to answer
Posted by:
terebent
10 years ago
Build a script and add the uninstallation command lines for each application in exact order you want.
Here is an example:
Option Explicit
Dim strScriptPath : strScriptPath = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\")-1)
Dim objWSH
Set objWSH = CreateObject("WScript.Shell")
if MSIInstalled("{31E11496-1F84-4DCC-B07A-369B40B8B4A7}") then
objWSH.Run "msiexec /x {31E11496-1F84-4DCC-B07A-369B40B8B4A7} /qn",,True
end if
'English
if MSIInstalled("{CCA40624-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40624-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
if MSIInstalled("{3186ACD0-B5C5-470E-ABE1-E4110C0A72BF}") then
objWSH.Run "msiexec /x {3186ACD0-B5C5-470E-ABE1-E4110C0A72BF} /qn",,True
end if
'Romanian
if MSIInstalled("{CCA40692-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40692-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'French
if MSIInstalled("{CCA40628-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40628-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'German
if MSIInstalled("{CCA40629-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40629-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Spanish
if MSIInstalled("{CCA40631-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40631-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Sweedish
if MSIInstalled("{CCA40637-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40637-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Hungarian
if MSIInstalled("{CCA40676-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40676-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Polish
if MSIInstalled("{CCA40678-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40678-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Japanese
if MSIInstalled("{CCA40630-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40630-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Italian
if MSIInstalled("{CCA40632-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40632-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Turkish
if MSIInstalled("{CCA40656-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40656-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Czech
if MSIInstalled("{CCA40675-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40675-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Russian
if MSIInstalled("{CCA40679-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40679-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Chinese (Traditional)
if MSIInstalled("{CCA40687-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40687-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Chinese (Simplified)
if MSIInstalled("{CCA40689-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40689-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Estonian (English)
if MSIInstalled("{CCA40602-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40602-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
'Dutch Netherlands
if MSIInstalled("{CCA40623-843E-48C6-B14F-E1070015D87C}") then
objWSH.Run "msiexec /x {CCA40623-843E-48C6-B14F-E1070015D87C} /qn",,True
end if
Function MSIInstalled(strProductCode)
Dim colList
Dim strItem
Dim objWI
Set objWI = CreateObject("WindowsInstaller.Installer")
For Each strItem In objWI.Products
If UCase(strProductCode) = UCase(strItem) Then
MSIInstalled = True
Exit Function
End If
Next
MSIInstalled = False
End Function
The script is verifing for each msi if is installed or not and if is installed them will uninstall it.
Comments:
-
Thanks for answers - Asker 10 years ago
Posted by:
andrew_lubchansky
10 years ago