SET pcAGUID=12518183-866A-11D3-97DF-0000F8D8F2E9|| :: Latest pcA agent GUID
SET pcANSGUID=125E8183-866A-11D3-97DF-0000F8D8F2E9|| :: Latest pcA agent GUID for NS v7 Solution
SET pcAInstallDir=C:\Program Files\Symantec\pcAnywhere|| :: Default location where pcA is installed. (This is set just incase the registry portion was removed but folders still exist locally. Current value doesn't work with 64-bit systems.)
SET pcAInstallDir64=C:\Program Files (x86)\Symantec\pcAnywhere|| :: Default location where pcA is instaleld on 64-bit systems.
:: #- Set default location where pcAnywhere host files exist
VER|FIND /I "Version 6" && SET AppData=&& :: Re-set AppData variables if computer is Vista.
SET pcASettingsDir=%AllUsersProfile%\Application Data\Symantec\pcAnywhere|| :: Default location where pcA data is located
SET HostDir=%pcASettingsDir%\Hosts|| :: Set default location of Host folder
:: #- Set default location where pcAnywhere "Remotes" folder exists
SET RemoteDir=%pcASettingsDir%\Remotes|| :: Detfault folder for Remotes location
:: #- Directory where pcAnywhere is installed (Set %pcAInstallDir%)
FOR /F "tokens=2*" %%i IN ('REGv1 QUERY "HKLM\SOFTWARE\Symantec\pcAnywhere\CurrentVersion\System\InstallDir"') DO (SET pcAInstallDirTest=%%j)
IF EXIST "%pcAInstallDirTest%" SET pcAInstallDir=%pcAInstallDirTest%|| :: Re-set pcAInstallDir if directory exist as detailed in registry, else use old setting.
IF EXIST "C:\Program Files\Altiris\Altiris Agent\AeXNSAgent.exe" (CALL "C:\Program Files\Altiris\Altiris Agent\AeXNSAgent.exe" /uninstall)
:RemoveShares
:: #- Cleanup uninstall - delete any shares that are still active.
ECHO.
ECHO Making sure Symantec Management Agents were uninstalled correctly.
ECHO ... Checking / deleting any remaining hidden shares
FOR /F "tokens=1*" %%i in ('NET SHARE ^| FIND /I "PkgSvrHost"') DO (NET SHARE %%i "%%j" /DELETE /Y)
:: #- Double Checking to make sure shares are gone
NET SHARE | FIND /I "PkgSvrHost" && Color 74 && ECHO ... hidden shares from Package Server did NOT remove! ^:-( && ECHO Make sure you have administrative rights to the folder where Symantec Management Agents are installed && ECHO Then re-run the Symantec Management uninstall program again. && Timeout 30 && COLOR 70 || ECHO ... verified - no hidden shares from Package Server exist.
:RemoveAltirisAgentAutoDeploy
:: #- Force the removal of AltirisAgentAutoDeploy
rem CALL MsiExec.exe /X{DAB76F40-BE93-481A-8ED4-B983F78BB798} /QN && ECHO Removed "Altiris Agent Auto Deploy" v2.0.1|| :: "remmed" this section out because we think if it remains in Add/Remove, the GPO won't try to re-install it.
:: #- Remove all incidents of FullInstall.vbs from AT command
FOR /F %%i IN ('AT ^| Find /i "FullInstall.vbs"') DO (AT %%i /Delete /Yes)
:: #- Remove FullInstall.vbs from local drive
IF EXIST "C:\Program Files\Jacobs\AltirisAgentAutoDeploy\fullinstall.vbs" (PUSHD C:\Program Files\Jacobs\AltirisAgentAutoDeploy >NUL && DEL *.* /F /Q >NUL && POPD)
IF EXIST "C:\Program Files\Jacobs\AltirisAgentAutoDeploy" RMDIR "C:\Program Files\Jacobs\AltirisAgentAutoDeploy" /Q
:PatchIssues
:: #- If Patch Management components are installed and agent has been re-installed to new location errors happen. Search and remove the issue so "Software Updates" tab will re-install correctly in the agent.
REGv1 QUERY "HKLM\SOFTWARE\Classes\Installer\Products\BFFB748AE77A17D42AF22686AE1F1BBA">NUL && ECHO ... Fixing Registry so "Software Updates" tab shows up in Symantec Management agent area. && REGv1 DELETE "HKLM\SOFTWARE\Classes\Installer\Products\BFFB748AE77A17D42AF22686AE1F1BBA" /FORCE
:: #- Check to see if Altiris is still running before renaming folder. If exist, stop it or kill it. (Use both PSLIST and TaskList commands to find ID number of anything running that has AeX.)
NET STOP "Altiris Agent" /Y 2>NUL|| REM Stop NS v6 agent
NET STOP "Symantec Management Agent" /Y 2>NUL|| REM Stop NS v7 agent
FOR /F "tokens=2 " %%i IN ('PSLIST ^| FIND /I "AeX"') DO (KILL -F %%i)
IF NOT "%OSver%"=="2K" FOR /F "tokens=2 " %%i IN ('TaskList ^| FIND /I "AeX"') DO (KILL -F %%i)