Avatar of radar365
radar365Flag for United States of America

asked on 

FOR Loop copy msvcr71.dll to the %systemroot% of 300 Servers

I need to create a for loop batch file to copy the msvcr71.dll (from a directory lets say C:\)  to the %systemroot% of 300+ Servers.  Please help ASAP.  Much thanks in advance.
Windows Server 2003

Avatar of undefined
Last Comment
Shift-3
Avatar of Shift-3
Shift-3
Flag of United States of America image

Paste the script below into a text file with a .cmd extension.  Enter the server names into a text file named serverlist.txt, one per line.  Running the script will copy the .dll file to each server (assuming you are running it under an account with permissions to those folders).



@echo off
 
for /F %%G in (serverlist.txt) do xcopy "c:\msvcr71.dll" "\\%%G\admin$\" /C /H /R /Y /Z

Open in new window

Avatar of radar365
radar365
Flag of United States of America image

ASKER

The file needs to be copied to the C:\Windows\System32 folder ot the C:\Winnt\system32 folder respectivly.  tks.
Avatar of Shift-3
Shift-3
Flag of United States of America image

Aha.  That wasn't what you said.



@echo off
 
for /F %%G in (serverlist.txt) do xcopy "c:\msvcr71.dll" "\\%%G\admin$\system32\" /C /H /R /Y /Z

Open in new window

Avatar of radar365
radar365
Flag of United States of America image

ASKER

Thanks this works great, I would also like to add a log so that I can see which server names this copy worked on and which ones it did not.  Much thanks for your quick response.
ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
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

U R da MAN!  One last thing with running this on ever 300 servers I am having to spend a lot of time on going over the log file to individually get the server names this failed on.  Is there an easier way to just log the server names with errors?  This would be very helpfull.  TKS.
Avatar of radar365
radar365
Flag of United States of America image

ASKER

Great answer.  I am allways greatly appreciative of all the assistance.  You guys are wonderfull.
Avatar of Shift-3
Shift-3
Flag of United States of America image

This will capture just the names of the servers where the copy encountered errors.



@echo off
 
for /F %%G in (serverlist.txt) do (
 xcopy "c:\msvcr71.dll" "\\%%G\admin$\system32\" /C /H /R /Y /Z >> NUL 2>>&1
 if errorlevel 1 echo %%G >> log.txt
)

Open in new window

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