Solved

Change xcopy timeout setting

Posted on 2008-10-04
5
2,774 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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Even if you have implemented a Mobile Device Management solution company wide, it is a good idea to make sure you are taking into account all of the major risks to your electronic protected health information (ePHI).
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

728 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