Thursday, August 18, 2011

Script for Removing Civil 3D 2011 with Configuration Manager

Script for uninstalling Autodesk Civil 3D 2011 and cleaning up leftover goodies.  I used this for removing it from a batch of computers using Microsoft System Center Configuration Manager.  I hope it helps...

@echo off
rem ****************************************************************
rem Filename..: uninstall.cmd
rem Author....: David M. Stein
rem Date......: 08/17/2011
rem Purpose...: uninstall AutoCAD Civil 3D 2011 and cleanup junk
rem ****************************************************************
CLS
SETLOCAL
SET APPNAME=Civil3D2011
SET LOG=%TMP%\%APPNAME%_uninstall.log
echo %DATE% %TIME% installing... %APPNAME%... >%LOG%
echo %DATE% %TIME% source....... %~dps0 >>%LOG%
echo %DATE% %TIME% target....... %COMPUTERNAME% >>%LOG%
echo %DATE% %TIME% windir....... %WINDIR% >>%LOG%
echo %DATE% %TIME% progfiles.... %PROGRAMFILES% >>%LOG%
echo %DATE% %TIME% temp......... %TMP% >>%LOG%
echo ----------------------------------------------- >>%LOG%
if exist "%ProgramFiles%\Autodesk\AutoCAD Civil 3D 2011\acad.exe" GOTO UNINSTALL
GOTO NOTFOUND

:NOTFOUND
echo %DATE% %TIME% info: application was not found on this computer >>%LOG%
GOTO END

:UNINSTALL
echo %DATE% %TIME% info: autodesk civil 3d 2011 >>%LOG%
msiexec /x {5783F2D7-9000-0409-0002-0060B0CE6BBA} /quiet /norestart
echo %DATE% %TIME% info: exit code is %errorlevel%... >>%LOG%
rem
echo %DATE% %TIME% info: autodesk civil 3d 2011 language pack >>%LOG%
msiexec /x {5783F2D7-9000-0409-1002-0060B0CE6BBA} /quiet /norestart
echo %DATE% %TIME% info: exit code is %errorlevel%... >>%LOG%
rem
echo %DATE% %TIME% info: civil 3d 2011 material library >>%LOG%
msiexec /x {9DEABCB6-B759-4D52-92F8-51B34A2B4D40} /quiet /norestart
echo %DATE% %TIME% info: exit code is %errorlevel%... >>%LOG%
rem
echo %DATE% %TIME% info: civil 3d 2011 material base image library >>%LOG%
msiexec /x {CD1E078C-A6B9-47DA-B035-6365C85C7832} /quiet /norestart
echo %DATE% %TIME% info: exit code is %errorlevel%... >>%LOG%
rem
echo %DATE% %TIME% info: design review 2011 >>%LOG%
msiexec /x {8D20B4D7-3422-4099-9332-39F27E617A6F} /quiet /norestart
echo %DATE% %TIME% info: exit code is %errorlevel%... >>%LOG%
rem
echo %DATE% %TIME% info: directx 9 for civil 3d 2011 >>%LOG%
msiexec /x {0B8F69E3-5983-4B2B-B464-5D833C76773D} /quiet /norestart
echo %DATE% %TIME% info: exit code is %errorlevel%... >>%LOG%
rem
echo %DATE% %TIME% info: faro ls >>%LOG%
msiexec /x {951B0F30-9F1A-4BF6-B3DA-99EB0E917B1C} /quiet /norestart
echo %DATE% %TIME% info: exit code is %errorlevel%... >>%LOG%
rem
GOTO CLEANUP

:CLEANUP
echo %DATE% %TIME% info: cleaning up leftover files and folders... >>%LOG%
del "%ProgramFiles%\Autodesk\AutoCAD Civil 3D 2011\*.*" /s /f /q
rd "%ProgramFiles%\Autodesk\AutoCAD Civil 3D 2011" /s /q
rd "%ProgramFiles%\Common Files\Autodesk Shared\Materials2011" /s /q
echo %DATE% %TIME% info: cleanup completed >>%LOG%
GOTO END

:END
echo ----------------------------------------------- >>%LOG%
echo %DATE% %TIME% uninstall completed / exit code: %errorlevel% >>%LOG%
ENDLOCAL
if %errorlevel%==3010 (
rem force a zero return if success and reboot needed
exit 0
) else (
if %errorlevel%==1605 (
rem force a zero return if msi packages not found
exit 0
) else (
exit %errorlevel%
)
)
Post a Comment