?
Solved

Change xcopy timeout setting

Posted on 2008-10-04
5
Medium Priority
?
2,845 Views
Last Modified: 2012-05-05
I am running a script that uses the xcopy command to add a scheduled task to several workstations. This is the script.
for /F %%G in (computers.txt) do (
 xcopy defrag.job \\%%G\admin$\tasks\ /C /H /R /Y
 schtasks /change /s %%G /RU "NT AUTHORITY\SYSTEM" /tn Defrag
)
When workstations are not on the timeouts cause the script to take too long to complete. How can I change the timeout to a shorter setting to speed up the processing of the script.
0
Comment
Question by:jasonx09
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 6

Expert Comment

by:Grizzly072000
ID: 22641476
Use robocopy instead. Much better tool than xcopy.
0
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 total points
ID: 22641739
robocopy is basically better indeed, but we're just talking about a single file here, and even robocopy will have to wait for the redirector's response when trying to access the remote machine.
Simply ping the machine before you actually start the copy:

for /F %%G in (computers.txt) do (
 ping %%G | find /i "TTL" >NUL
 if errorlevel 1 (
  echo ... no response
 ) else (
  xcopy defrag.job \\%%G\admin$\tasks\ /C /H /R /Y
  schtasks /change /s %%G /RU "NT AUTHORITY\SYSTEM" /tn Defrag
 )
)

Open in new window

0
 
LVL 6

Expert Comment

by:Grizzly072000
ID: 22641778
@oBdA: Single file? Then why xcopy? copy is plenty.

Some robocopy options that might solve the OP's problem:

          /R:n : number of Retries on failed copies - default is 1 million.
          /W:n : Wait time between retries - default is 30 seconds.
          /TBD : Wait for a sharename to be created by retrying on error 67
          /Z : Copies files in restartable mode.
0
 

Author Closing Comment

by:jasonx09
ID: 31503055
I'm not sure that I understand the find portion of the solution but it works well. It took the wait for the timeouts from 20 seconds to 10 seconds. I also added the -w switch to specify the timeout as 240 mil. This took the time down to 5 seconds per failure. Thank you for your help.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

WARNING:   If you follow the instructions here, you will wipe out your VTP and VLAN configurations.  Make sure you have backed up your switch!!! I recently had some issues with a few low-end Cisco routers (RV325) and I opened a case with Cisco TA…
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question