/build/static/layout/Breadcrumb_cap_w.png

Multiple MS product uninstall script

I have been given the task of removing all unused copies of MS Visio and MS Project from our user base of about 1000 computers using Altiris. We have already identified who the users/computers are. However, we have 5 different versions of Visio and 6 different versions of Project that need to be removed. How can I write a script that will uninstall all versions of Project as one package, and do the same for Visio?

Any and all suggestions are eagerly accepted.

Thank you!

0 Comments   [ + ] Show comments

Answers (3)

Posted by: robtk 14 years ago
Senior Purple Belt
0
I would write a vbscript that checks for the existence of the application uninstall string in the registry. Finding that, do a silent uninstall of the app.
Posted by: RonW 14 years ago
Green Belt
0
Did a similar project all in Wise Package Studio, using the uninstall strings from the registry and then doing some testing to make sure everything uninstalled quietly. Code looked like this:


item: Remark
Text=****************************************************************
end
item: Remark
Text= Remove Microsoft Project
end
item: Remark
Text=****************************************************************
end
item: Remark
Text=Project 98
end
item: Get Registry Key Value
Variable=PROJ98
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Project 8.0
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=PROJ98
Flags=00000001
end
item: Execute Program
Pathname="%C%\Program Files\Microsoft Office\Office\Setup\AcmePrj.exe"
Command Line=/w prj98.stf /UA /QNT
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Project 2000 SR-1
end
item: Get Registry Key Value
Variable=PROJ2000
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{2DFE1608-BDCA-11D1-B7AE-00C04FB92F3D}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=PROJ2000
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {2DFE1608-BDCA-11D1-B7AE-00C04FB92F3D} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Project 2002
end
item: Get Registry Key Value
Variable=PROJ2002
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{903A0409-6000-11D3-8CFE-0050048383C9}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=PROJ2002
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {903A0409-6000-11D3-8CFE-0050048383C9} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Project Pro 2002
end
item: Get Registry Key Value
Variable=PROJPRO2002
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{903B0409-6000-11D3-8CFE-0050048383C9}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=PROJPRO2002
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {903B0409-6000-11D3-8CFE-0050048383C9} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Project 2003 Std
end
item: Get Registry Key Value
Variable=PROJ2003STD
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{903A0409-6000-11D3-8CFE-0150048383C9}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=PROJ2003STD
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {903A0409-6000-11D3-8CFE-0150048383C9} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Project 2003 Pro
end
item: Get Registry Key Value
Variable=PROJ2003PRO
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{903B0409-6000-11D3-8CFE-0150048383C9}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=PROJ2003PRO
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {903B0409-6000-11D3-8CFE-0150048383C9} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
end
item: Remark
end
item: Remark
end
item: Remark
Text=****************************************************************
end
item: Remark
Text= Remove Microsoft Visio
end
item: Remark
Text=****************************************************************
end
item: Remark
end
item: Remark
Text=Visio 2000 Standard SR1
end
item: Get Registry Key Value
Variable=VISIO2000STD
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{63EF6DD2-F1F1-11D2-9F29-006008A88EC8}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=VISIO2000STD
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {63EF6DD2-F1F1-11D2-9F29-006008A88EC8} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Visio 2000 Pro SR1
end
item: Get Registry Key Value
Variable=VISIO2000PRO
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{63EF6DD2-F1F1-11D2-9F29-006008A88EC8}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=VISIO2000PRO
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {63EF6DD2-F1F1-11D2-9F29-006008A88EC8} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Visio 2002 Standard SR1
end
item: Get Registry Key Value
Variable=VISIO2002STD
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90540409-6D54-11D4-BEE3-00C04F990354}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=VISIO2002STD
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {90540409-6D54-11D4-BEE3-00C04F990354} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Visio 2002 Pro SR1
end
item: Get Registry Key Value
Variable=VISIO2002PRO
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90510409-6D54-11D4-BEE3-00C04F990354}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=VISIO2002PRO
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {90510409-6D54-11D4-BEE3-00C04F990354} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Visio 2003 Standard
end
item: Get Registry Key Value
Variable=VISIO2003STD
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90530409-6000-11D3-8CFE-0150048383C9}
Value Name=DisplayName
Flags=00000100
end
item: If/While Statement
Variable=VISIO2003STD
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {90530409-6000-11D3-8CFE-0150048383C9} /qn
Flags=00000010
end
item: End Block
end
item: Remark
end
item: Remark
Text=Visio 2003 Pro
end
item: Get Registry Key Value
Variable=VISIO2003PRO
Key=SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90510409-6000-11D3-8CFE-0150048383C9}
Value Name=DisplayName
Flags=00010100
end
item: If/While Statement
Variable=VISIO2003PRO
Flags=00000001
end
item: Execute Program
Pathname=%system%\MsiExec.exe
Command Line=/x {90510409-6000-11D3-8CFE-0150048383C9} /qn
Flags=00000010
end
item: End Block
end

Posted by: anonymous_9363 14 years ago
Red Belt
0
The script route is a good idea. With respect, the WiseScript example is a little tortuous and doesn't lend itself to re-use.

Ideally, your script will have a function that retrieves the uninstall string, then calls a separate function to execute the uninstall. Having your code in modules makes it much easier to debug and maintain. The first functions gets called by the main module. This module will consist of a array or dictionary (your choice) of entries which appear in the 'Uninstall' registry key. These can be GUIDs or plain text names, since both could be used, depending on vendor's whim. You could avoid the registry stuff by using the WindowsInstaller.Installer object which has (IIRC) a methodcalled 'InstallProduct' and another called 'UninstallProduct'. It'll all be on MSDN/TechNet. If you go the registry route, can I recommend the cRegistry class from from the JMWare class pack? It abstracts the WMI StdRegProv provider quite neatly.

Some bare-bones code:strProductList = "Some app,"
strProductList = strProductList & "{903A0409-6000-11D3-8CFE-0050048383C9},"
strProductList = strProductList & "{63EF6DD2-F1F1-11D2-9F29-006008A88EC8}"

'// Add a trap here for missed trailing comma (my favourite missed error).
'// Create the array.
'// You could go straight for 'arrProducts = Array("[someGUID]", "[someotherGuid]","[yetanother]")' etc. but I find the above somehow
'// more intuitive. HFC, I suppose...
arrProducts = Split(strProductList, ",")
For intBlah = 0 To UBound(arrProducts)
strProduct = arrProducts(intBlah)
'// Call function to get uninstall string. You'll need a referenced (ByRef) variable in the function for that.
blnResult = GetUninstallStringFromRegistry(strProduct, strUninstallString)
If Not blnResult Then
'// Display/record error (in event viewer, maybe?)
'// and bail
End If

blnResult = UninstallProduct(strUninstallString)
If Not blnResult Then
'// Display/record error (in event viewer, maybe?)
'// and bail
End If

'// Being paranoid, I'd add a trap here, to test that the product actually got uninstalled
Next
You get the idea.

This way, you can add whatever products you want. You could (as I did for a client) use an INI/INF file to drive the whole thing. That way, you can have a third party edit the list, meaning they don't have to know script at all, just how to use a text editor.

Remember at all times, though, the VBScab mantra "Assume that NOTHING will work and error-trap it all."
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ