search cancel

CMD Script to clean-up legacy task & policy info

book

Article ID: 163688

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

How to clean-up 7.5 agents that are not upgrading to 8.0 for various reasons.

Environment

ITMS 8.0 (upgraded from ITMS 7.5)

Resolution

The following script will stop the 7.5 agent, clean-up a number of directories and restart the agent. This should allow the agent to communicate with the SMP and to download the upgrade policy (and finally be able to upgrade to 8.0).

@ECHO OFF
REM CHECK WE CAN ACCESS THE CLIENT
PING -n 1 %COMPNAME% || ECHO CANNOT PING %COMPNAME% & EXIT 99
 
REM STOP THE AGENT
sc \\%COMPNAME% STOP AeXNSClient || ECHO CANNOT STOP AGENT ON %COMPNAME% & EXIT 911
 
REM WAIT 10 SECONDS FOR THE AGENT TO STOP
PING -n 10 -w 1000 %COMPNAME%
 
REM CLEANUP THE AGENT TASKS, HISTORY AND POLICIES
RD "\\%COMPNAME%\c$\ProgramData\Symantec\Symantec Agent\Ldb" /s /q
RD "\\%COMPNAME%\c$\Program Files\Altiris\Altiris Agent\TaskManagement" /s /q
RD "\\%COMPNAME%\c$\Program Files\Altiris\Altiris Agent\Agents\SoftwareManagement\Software Delivery" /s /q
DEL "\\%COMPNAME%\c$\Program Files\Altiris\Altiris Agent\Client Policies\*.xml" /f
 
REM STOP THE AGENT
sc \\%COMPNAME% START AeXNSClient || ECHO CANNOT START AGENT ON %COMPNAME% & EXIT 999
 
:END
EXIT 0