Avatar of radar365
radar365Flag for United States of America

asked on 

For Loop Batch file error logging

I would like to log the server names on which thereis errors on when running this script so that I can go back and check these individually.  This script is going to be run on 290+ servers and I dont want to have to go through and sort out the successes and failures.  It would be also good to know which ones completed successfully but I will take your reccomendation as what is the best way to do this.  Much thanks in advance.
for /f %%a in (srvlst_test.txt) do set server=%%a & call :start
goto end
 
:start
if exist \\%server%\c$\Run_1st_CCTool.bat goto Run_2nd_SGS.bat
copy Run_1st_CCTool.bat \\%server%\c$
 
:Run_2nd_SGS.bat
if exist \\%server%\c$\Run_2nd_SGS.bat goto execute
copy Run_2nd_SGS.bat \\%server%\c$
 
:execute
psexec.exe \\%server% -c Run_1st_CCTool.bat
psexec.exe \\%server% -c Run_2nd_SGS.bat
 
:end

Open in new window

Microsoft Server OSWindows BatchWindows Server 2003

Avatar of undefined
Last Comment
radar365
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of radar365
radar365
Flag of United States of America image

ASKER

Great.  I was able to midify it and it is working wonderfully.  Thanks.
Windows Server 2003
Windows Server 2003

Windows Server 2003 was based on Windows XP and was released in four editions: Web, Standard, Enterprise and Datacenter. It also had derivative versions for clusters, storage and Microsoft’s Small Business Server. Important upgrades included integrating Internet Information Services (IIS), improvements to Active Directory (AD) and Group Policy (GP), and the migration to Automated System Recovery (ASR).

129K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo