SET SV=6.0.2403.3|| :: Set Script Version (SV) variable for Virtual Standardized Office (VSO)
:: #- Display the following message in the title bar.
TITLE Re-installing Symantec Management Agent version %SV%|| :: Title given to this script file.
:: #- Temporarily set %SystemRoot% and System32 folders as primary folders in %Path% (Discovered 3rd party programs setting their folders as primary and then they name their .exe same name as MS OS such as Oracle has their own version of Find.exe which doesn't work like MS Find.exe. So any batch file trying to call find.exe will fail.)
SET Path=%SystemRoot%;%SystemRoot%\System32;%Path%
:: #- Detect OS and set new variables to identify OS.
SET Processor|FIND "64">NUL&& SET BIT=64|| REM General 64 BIT OS
VER|FIND /I "6001">NUL && SET OSVER=Vista64|| REM Operating system is Vista 64 bit.
VER|FIND /I "6000">NUL && SET OSVER=Vista32|| REM Operating system is Vista 32 bit.
VER|FIND /I "5.2">NUL && SET OSver=23|| REM Operating System is windows 2003
VER|FIND /I "XP">NUL && SET OSver=XP|| REM Operating System is windows XP
VER|FIND /I "Windows 2000">NUL && SET OSver=2K|| REM Operating System is Windows 2000
VER|FIND /I "NT">NUL && SET OSver=NT|| REM Operating System is Windows NT 4.0
:: #- Reports Directory
SET NetworkReportsDir=\\oakman07\storage\Temp\Upload\Capture Agents Installed|| :: Network directory where reports are copied up too. (Centralization)
:: #- Set Date variables for Day (spelled out), Month, Day (time), Year
FOR /F "tokens=1,2,3,4 delims=/ " %%i IN ('DATE /T') DO (set Day=%%i&& set MM=%%j&& SET DD=%%k&& SET YY=%%l)
:: #- Set time variables for Hr, Min, AM or PM
FOR /F "tokens=1,2,3,4 delims=: " %%i IN ('Time /T') DO (set Hr=%%i&& set Min=%%j&& SET AMPM=%%k)
:: #- If temp directory is not set, set it. If not, this batch file may fail.
SET TempDir=%Temp%|| :: Default temp directory of the OS.
IF NOT EXIST "%Temp%" SET TempDir=%SystemDrive%\temp\apps|| :: If no temp directory exists, then set it.
IF NOT EXIST "%TempDir%" MD "%TempDir%"|| :: Temp directory must exist or this script file may bomb out
:: #- Check if Re-install program is already running. If so, skip to the end (NS v7 Managed Software Solution causes re-install program to run multiple times while it uninstalls itself. If Popup is present, then skip to the end and don't run again.)
:CheckIfRunning
PSLIST | FIND /I "WINMSG" >NUL && ECHO ... Re-Install program already running.&& Timeout 15 && GOTO END
IF NOT "%OSver%"=="2K" TaskList | FIND /I "WINMSG" >NUL && ECHO ... Re-Install program already running.&& Timeout 15 && GOTO END
PSLIST | FIND /I "Uninstall-SM-Agents" >NUL && ECHO ... Re-Install program already running.&& Timeout 15 && GOTO END
IF NOT "%OSver%"=="2K" TaskList | FIND /I "Uninstall-SM-Agents" >NUL && ECHO ... Re-Install program already running.&& Timeout 15 && GOTO END
:ThrottleCPU
CALL ThrottleCPU.cmd
:ReadSwitches
:: #- Set default variables and read in %1 to convert input data into appropriate variables (Look at batch file for more details)
:: #- Show popup to let this batch file and any users viewing the install that the install happening.
START WINMSG -t "Re-install Altiris Agent v%AgentVersion% to %NSFQDN%" -m " Jacobs IT is re-installing your Altiris agent.\n\n Please stand by ... \n\n (This window should close automatically when install is complete.)" -c SystemModal,Information