Autodesk makes a pretty bold effort to get their products blasted onto desktops in large quantities. It's not a perfect effort, and requires some hand-holding and customization here and there, but it's bold. However, the uninstall effort is non-existent. After all, why would they want to help you remove their products? You can do that via Add or Remove Programs, right? Yeah. Sure. On 5,000 computers by tomorrow. Good luck with that.
Fear not. They do leave enough crumbs behind to allow you to whip out your scripting dog and follow the scent back home to a clean desktop configuration. Ok, cleanER more than clean. Here's a script that you can call from SCCM to remove AutoCAD LT 2011. I prefer to wrap the call inside a .BAT or .CMD script so I can pipe the echo statements to a client-side log file for troubleshooting. But you can do whatever you like.
To wrap inside a .BAT/.CMD script, try this…
cscript <path>\uninstall_2011_acadlt.vbs >%TMP%\acadlt2011_uninstall.log
(where <path> is the UNC path to where you share the script file)
BEGIN VBSCRIPT…
'****************************************************************
' Filename..: uninstall_2011_acadlt.vbs
' Author....: David M. Stein
' Date......: 08/16/2010
' Purpose...: uninstall autocad lt 2011
' SQL.......: N/A
'****************************************************************
Option Explicit
wscript.echo "info: initialized " & Now
wscript.echo "info: script executed from " & wscript.ScriptFullName
Dim oShell, oFSO, progfiles, sysdrive, counter : counter = 0
Set oShell = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
progfiles = oShell.ExpandEnvironmentStrings("%programfiles%")
sysdrive = oShell.ExpandEnvironmentStrings("%systemdrive%")
wscript.echo "info: product installation was found."
CleanApp "Autodesk Material Library 2011", "{9DEABCB6-B759-4D52-92F8-51B34A2B4D40}"
CleanApp "AutoCAD LT 2011", "{5783F2D7-9009-0409-0002-0060B0CE6BBA}"
CleanApp "AutoCAD LT 2011 Language Pack - English", "{5783F2D7-9009-0409-1002-0060B0CE6BBA}"
CleanApp "Autodesk Design Review 2011", "{8D20B4D7-3422-4099-9332-39F27E617A6F}"
If counter > 0 Then
CleanFolder progfiles & "\Autodesk\AutoCAD LT 2011"
Else
wscript.echo "warn: no applications were removed"
End If
wscript.echo "info: " & counter & " applications removed"
wscript.echo "info: completed at " & Now
'----------------------------------------------------------------
' function: check if reg key exists under Uninstall tree
'----------------------------------------------------------------
Function IsInstalled(keyname)
Dim basekey
basekey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
If RegKeyExists(basekey & keyname & "\") Then
IsInstalled = True
End If
End Function
'----------------------------------------------------------------
' function: return True if registry key exists
' EXAMPLE: If RegKeyExists("HKLM\Sofwtare\ACME\TestKey\Value1") Then
'----------------------------------------------------------------
Function RegKeyExists(key)
Dim bKey
On Error Resume Next
bKey = oShell.RegRead(key)
If err.Number = 0 Then
RegKeyExists = True
End If
End Function
'----------------------------------------------------------------
' function: run MSIEXEC to uninstall a GUID-based app
'----------------------------------------------------------------
Sub Uninstall(key)
oShell.Run "msiexec.exe /x " & key & " /qn", 7, True
End Sub
'----------------------------------------------------------------
' function: macro to check for app and remove it
'----------------------------------------------------------------
Sub CleanApp(name, keyname)
wscript.echo "info: searching for " & name
If IsInstalled(keyname) Then
wscript.echo "info: removing " & name
Uninstall keyname
counter = counter + 1
Else
wscript.echo "info: " & name & " is not installed"
End If
End Sub
'----------------------------------------------------------------
' function:
'----------------------------------------------------------------
Sub CleanFolder(path)
Dim retval
If oFSO.FolderExists(path) Then
On Error Resume Next
retval = oFSO.DeleteFolder(path, True)
If err.Number = 0 Then
wscript.echo "info: folder deleted = " & path
Else
wscript.echo "warn: folder not deleted = " & path
End If
Else
wscript.echo "warn: folder not found = " & path
End If
End Sub
'----------------------------------------------------------------
' function:
'----------------------------------------------------------------
Function ScriptPath()
ScriptPath = Replace(wscript.ScriptFullName, _
"\" & wscript.ScriptName, "")
End Function
I'll post another version of this for AutoCAD Civil 3D 2011 sometime soon.
Nice. thanks
ReplyDeleteDo you have a script like this for uninstalling autocad LT 2007? Do you know if there are issues trying to install autocad 2011 on a computer that has autocad LT 2007 installed? My sccm install says it is installed but the program is not showing up on an xp pc. Thanks so much for your help
ReplyDeleteI do not have one for LT 2007, but if you have it installed, just poke in the registry to find the keys and values (use REGEDIT), and note whatever folders are related. Then just modify the script to suit. That's what I do for each release as time rolls along.
ReplyDeleteAs for the 2011 on LT 2007 goes, they shouldn't impact each other, but 2011 will likely take over the DWG file association.
As for the SCCM issue, read my post on AutoCAD 2011 and DirectX.
Thanks so much. Will do.
ReplyDeleteThis is AWESOME! I was looking for something to uninstall AutoCAD Inventor LT 2011 via SCCM but was able to easily modify this to add the Inventor LT uninstall and do it all at once without multiple packages. This is a keeper and I can re-use this with other packages for other apps!
ReplyDelete-Wayne
Thanks Wayne! I'm glad it was helpful.
ReplyDelete