Hi, I'm writing a batch file that will replace the sylink.xml file on the remote client, rather than using the Sylink replacer application. So far my efforts have been successful, but I have to do it in two parts. First, I have to PING the computer to ensure it's online. Then I execute my batch file if the remote client is online.
What I would like to do is PING and execute all in one action by adding the required lines into my batch file. I want it to:
a) PING the machine and if it's offline, QUIT, or
b) PING the machine and if it's online, execute the sylink.xml replacement
My knowledge of batch programming is fairly limited, although I can program batch files to a certain point to get it to do what I want but sometimes I have problems with commands that are a little more complex.
Here's my current batch file. Feel free to use it if you want to. It works the way it is except for the PING feature I want to add. I'm not interested in receiving any credit for it, I just believe in helping people where help is required.
What this batch file does - looks in all possible locations where SEP could be installed on any given Windows operating system, then if it finds the correct path, the file will go to where the sylink.xml file resides and copy the new sylink.xml file to that location, then quit.
Note, in order to make this work, you must also have PSEXEC.exe and SLEEP.exe reside in the same folder that the batch file is executed from.
The proper execution is, assuming you call your batch file 'update.bat':
c:> update hostname or
c:> update ip_address
=============copy and paste into a new batch file================
@ECHO OFF
IF EXIST "\\%1\c$\Program Files\Symantec\Symantec Endpoint Protection" goto SEP4
IF EXIST "\\%1\c$\Program Files\Symantec Endpoint Protection" goto SEP1
IF EXIST "\\%1\c$\Program Files (x86)\Symantec\Symantec Endpoint Protection" goto SEP2
IF EXIST "\\%1\c$\Program Files\Symantec Antivirus" goto SEP3
:SEP1
PSEXEC \\%1 "c:\Program Files\Symantec\Symantec Endpoint Protection\smc.exe" -p "password" -stop
SLEEP 10
COPY SyLink.xml "\\%1\c$\Program Files\Symantec\Symantec EndPoint Protection\" /y
SLEEP 10
PSEXEC \\%1 "c:\Program Files\Symantec\Symantec Endpoint Protection\smc.exe" -start
GOTO END
:SEP2
PSEXEC \\%1 "c:\Program Files (x86)\Symantec\Symantec Endpoint Protection\smc.exe" -p "password" -stop
SLEEP 10
COPY SyLink.xml "\\%1\c$\Program Files (x86)\Symantec\Symantec EndPoint Protection\" /y
SLEEP 10
PSEXEC \\%1 "c:\Program Files (x86)\Symantec\Symantec Endpoint Protection\smc.exe" -start
GOTO END
:SEP3
PSEXEC \\%1 "c:\Program Files\Symantec Antivirus\smc.exe" -p "password" -stop
SLEEP 10
COPY SyLink.xml "\\%1\c$\Program Files\Symantec Antivirus\" /y
SLEEP 10
PSEXEC \\%1 "c:\Program Files\Symantec Antivirus\smc.exe" -start
GOTO END
:SEP4
PSEXEC \\%1 "c:\Program Files\Symantec\Symantec Endpoint Protection\smc.exe" -p "password" -stop
SLEEP 10
COPY SyLink.xml "\\%1\c$\Program Files\Symantec\Symantec Endpoint Protection\" /y
SLEEP 10
PSEXEC \\%1 "c:\Program Files\Symantec\Symantec Endpoint Protection\smc.exe" -start
GOTO END
:END
ECHO DONE!
=====================End Batch File ===========================
Any feedback or suggestions on how I can add a simple PING command to this batch file would be very much appreciated.
Thanks,
Dan