MyITGuy
5/13/2014 - 3:33 AM

Symantec Agent Repair 1: Stops the agent, deletes task management data, deletes queue data, starts the agent.

Symantec Agent Repair 1: Stops the agent, deletes task management data, deletes queue data, starts the agent.

psexec \\COMPUTER -d -f -c "agent_repair_1.cmd"

@ECHO OFF

REM Get the InstallDir from the registry
FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Altiris Agent" /V "InstallDir" ^| FINDSTR /i /c:"InstallDir"') DO SET InstallDir=%%B
IF NOT DEFINED InstallDir (
    FOR /F "tokens=2*" %%A IN ('REG.EXE QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432NODE\Altiris\Altiris Agent" /V "InstallDir" ^| FINDSTR /i /c:"InstallDir"') DO SET InstallDir=%%B
)
IF NOT DEFINED InstallDir GOTO:EOF
IF DEFINED InstallDir ECHO InstallDir: %InstallDir%

ECHO Disabling AeXNSClient service
sc config AeXNSClient start= disabled

for /F "tokens=3 delims=: " %%H in ('sc query "AeXNSClient" ^| findstr /i /c:"STATE"') do (
	if /I "%%H" EQU "RUNNING" (
		ECHO Stop AeXNSClient service
		"%InstallDir%\AeXAgentUtil.exe" /Stop
	)
)

ECHO Kill AeXNSAgent.exe process
taskkill /im AeXNSAgent.exe /f

ECHO Remove TaskManagement folder
IF EXIST "%InstallDir%\TaskManagement" RD /Q /S "%InstallDir%\TaskManagement"

ECHO Remove TaskManagement folder
IF EXIST "%InstallDir%\Queue" RD /Q /S "%InstallDir%\Queue"

ECHO Enable AeXNSClient service
sc config AeXNSClient start= auto

for /F "tokens=3 delims=: " %%H in ('sc query "AeXNSClient" ^| findstr /i /c:"STATE"') do (
	if /I "%%H" NEQ "RUNNING" (
		ECHO Start AeXNSClient service
		"%InstallDir%\AeXAgentUtil.exe" /Start
	)
)

GOTO:EOF