I am trying to accomplish the following but need help. We used have a manual process of verifying network connectivity in mornings by copying a small txt file from a DC to every main server in the company. I created a small batch file to do this, and another to run it giving the %1 source and %2 targets.
code:
@echo off
for /f "tokens=1,2,3,4* delims=- " %%i in ('date /t') do set TDDAY=%%i&set TDDD=%%j&set TDMM=%%k&set TDYY=%%l
REM Create Dir's
REM Log Directories
if not exist \\%2\c$\contest2 md \\%2\c$\contest2
if not exist \\%1\c$\contest\logs md \\%1\c$\contest\logs
if not exist \\%1\c$\contest\logs md \\%1\c$\contest\logs
REM Copy Section
echo Copying Connection test
xcopy %computername%_contest.txt \\%2\c$\contest2 /c /d /e > \\%1\c$\contest\logs\%1_%tdday%_contestlog.txt
if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit
:lowmemory
echo Insufficient memory to copy files or invalid drive or command-line syntax > \\%1\c$\contest\logs\%1_%tdday%_error.txt
goto exit
:abort
echo You Pressed CTRL+C to end the copy operation
goto exit
:exit
exit
However, i'd like to replace this with a KIX script and report to a log file. Right now it creates a folder with a txt file for each server it can't connect to. Ideally i'd like to put this into all one file and have a count at the end, so it would look like...
Server1 - Good
Server2 - Good
Server3 - Bad
Count -
2 Good, 1 Bad, 3 Total
Anyone already using something like this or could help?
Thanks