Uninstall Software Using Altiris Deployment Solution

Uninstall Software Using Altiris Deployment Solution
Filed under: Deployment Solution
erikw's picture

I often get a question how to uninstall software using Altiris Deployment Solution. This is not alway's as easy as we think. Below is a script that I wrote for a customer that can be used.

The script uninstalls Novell Groupwise, and it can be used as a sample to get the job done.

The example describes the uninstall for a XP client, A laptop with XP and a terminal server.

Change the variables as you wish.

::setting variables
SET DEPLOY_DRV=z:
SET DEPLOY_PATH=\novell.groupwise.uninstall
set SRC=%DEPLOY_DRV%%DEPLOY_PATH%
if not exist "%SYSTEMDRIVE%\temp" md "%SYSTEMDRIVE%\temp"
if not exist "%SYSTEMDRIVE%\temp\client" md "%SYSTEMDRIVE%\temp\client"
goto %CLNT%
echo No client variable set!
exit

:DESKTOP
xcopy "%SRC%\*.*" "%SYSTEMDRIVE%\apps\Novell\GroupWise\" /s /e /v /y
cd /d "%SYSTEMDRIVE%\apps\Novell\GroupWise\"
NXGWCR65.EXE /noui
if exist "C:\Documents and Settings\All Users\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk" del /q /f "C:\Documents and Settings\All Users\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk"
if exist "C:\Documents and Settings\All Users\Bureaublad\GroupWise.lnk" del /q /f "C:\Documents and Settings\All Users\Bureaublad\GroupWise.lnk"
if exist "c:\apps\Microsoft\Office\Office\Xlstart\gwxl97.xla" del /q /f "c:\apps\Microsoft\Office\Office\Xlstart\gwxl97.xla"
cd /d c:\apps
rd novell /s /q
goto end1

:LAPTOP
xcopy "%SRC%\*.*" "%SYSTEMDRIVE%\apps\Novell\GroupWise\" /s /e /v /y
cd /d "%SYSTEMDRIVE%\apps\Novell\GroupWise\"
NXGWCR65.EXE /noui
if exist "C:\Documents and Settings\All Users\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk" del /q /f "C:\Documents and Settings\All Users\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk"
if exist "C:\Documents and Settings\All Users\Menu Start\Programma's\Novell Groupwise" rd "C:\Documents and Settings\All Users\Menu Start\Programma's\Novell Groupwise" /s /q
if exist "C:\Documents and Settings\All Users\Bureaublad\GroupWise.lnk" del /q /f "C:\Documents and Settings\All Users\Bureaublad\GroupWise.lnk"
if exist "c:\apps\Microsoft\Office\Office\Xlstart\gwxl97.xla" del /q /f "c:\apps\Microsoft\Office\Office\Xlstart\gwxl97.xla"
cd /d c:\apps
rd novell /s /q
goto end1

:TSERVER
xcopy "%SRC%\*.*" "w:\apps\Novell\GroupWise\" /s /e /v /y
cd /d "w:\apps\Novell\GroupWise\"
NXGWCR65.EXE /noui
if exist "v:\Documents and Settings\All Users\Start Menu\Programs\Startup\GroupWise Notify.lnk" del /q /f "v:\Documents and Settings\All Users\Start Menu\Programs\Startup\GroupWise Notify.lnk"
if exist "v:\Documents and Settings\All Users\Desktop\GroupWise.lnk" del /q /f "v:\Documents and Settings\All Users\Desktop\GroupWise.lnk"
if exist "w:\apps\Microsoft\Office\Office\Xlstart\gwxl97.xla" del /q /f "w:\apps\Microsoft\Office\Office\Xlstart\gwxl97.xla"
cd /d w:\apps
rd novell /s /q
goto end1


:end1
echo deleting GroupWise Notifier startup shortcut
if exist "%ALLUSERSPROFILE%\Start Menu\Programs\Startup\GroupWise Notify.lnk" del /q /f "%ALLUSERSPROFILE%\Start Menu\Programs\Startup\GroupWise Notify.lnk"
if exist "%ALLUSERSPROFILE%\Desktop\GroupWise.lnk" del /q /f "%ALLUSERSPROFILE%\Desktop\GroupWise.lnk"
if exist "%ALLUSERSPROFILE%\Bureaublad\GroupWise.lnk" del /q /f "%ALLUSERSPROFILE%\Bureaublad\GroupWise.lnk"
if exist "%ALLUSERSPROFILE%\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk" del /q /f "%ALLUSERSPROFILE%\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk"
echo done
exit

Use this script to your advantage and uninstall any local software as you wish.

NOTE: I use this script as a uninstall.cmd. Then I deploy the uninstall.cmd to the client where it is started locally. For the network clients this is not necessary, but for the laptops it is the easiest way.

Regards
Erik Westhovens

3.68182
Average: 3.7 (22 votes)

goto %CLNT%

wuzfuzzy's picture

Where does this batch file get %CLNT% variable? I'm guessing you intended to pass this a a parameter to the batch file like uninstall.cmd LAPTOP

but this would require setting this up in the beginning of the batch file like this the first line looks to make sure the parameter is not null.

IF !%1==! EXIT
set CLNT=%1

Might I sugesst shortening this a little bit

wuzfuzzy's picture

You could set some variables and use them to do all the work ie

something like this

:DESKTOP
SET DEST_PATH=%SYSTEMDRIVE%\apps\Novell\GroupWise\
SET SHORTCUT_PATH=C:
SET XLA_PATH=C:
GOTO ENDL

:LAPTOP
SET DEST_PATH=%SYSTEMDRIVE%\apps\Novell\GroupWise\
SET SHORTCUT_PATH=C:
SET XLA_PATH=C:
GOTO ENDL

:TSERVER
SET DEST_PATH=w:\apps\Novell\GroupWise\
SET SHORTCUT_PATH=v:
SET XLA_PATH=w:
GOTO ENDL

xcopy "%SRC%\*.*" "%DEST_PATH%" /s /e /v /y

if exist "%SHORTCUT_PATH%\Documents and Settings\All Users\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk" del /q /f "%SHORTCUT_PATH%\Documents and Settings\All Users\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk"
if exist "%SHORTCUT_PATH%\Documents and Settings\All Users\Menu Start\Programma's\Novell Groupwise" rd %SHORTCUT_PATH%\Documents and Settings\All Users\Menu Start\Programma's\Novell Groupwise" /s /q
if exist "%SHORTCUT_PATH%\Documents and Settings\All Users\Bureaublad\GroupWise.lnk" del /q /f "%SHORTCUT_PATH%\\Documents and Settings\All Users\Bureaublad\GroupWise.lnk"
if exist "%XLA_PATH%\apps\Microsoft\Office\Office\Xlstart\gwxl97.xla" del /q /f "%XLA_PATH%\apps\Microsoft\Office\Office\Xlstart\gwxl97.xla"

if exist "%ALLUSERSPROFILE%\Start Menu\Programs\Startup\GroupWise Notify.lnk" del /q /f "%ALLUSERSPROFILE%\Start Menu\Programs\Startup\GroupWise Notify.lnk"
if exist "%ALLUSERSPROFILE%\Desktop\GroupWise.lnk" del /q /f "%ALLUSERSPROFILE%\Desktop\GroupWise.lnk"
if exist "%ALLUSERSPROFILE%\Bureaublad\GroupWise.lnk" del /q /f "%ALLUSERSPROFILE%\Bureaublad\GroupWise.lnk"
if exist "%ALLUSERSPROFILE%\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk" del /q /f "%ALLUSERSPROFILE%\Menu Start\Programma's\Opstarten\GroupWise Notify.lnk"