Solved

Change xcopy timeout setting

Posted on 2008-10-04
5
2,551 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
  • 3
5 Comments
 
LVL 6

Expert Comment

by:Grizzly072000
Comment Utility
Use robocopy instead. Much better tool than xcopy.
0
 
LVL 6

Expert Comment

by:Grizzly072000
Comment Utility
0
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
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
Comment Utility
@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
Comment Utility
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 You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This is an article about my experiences with remote access to my clients (so that I may serve them) and eventually to my home office system via Radmin Remote Control. I have been using remote access for over 10 years and have been improving my metho…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now