August 25, 2005

Scheduling Robocopy Jobs

You can create Robocopy jobs that run regularly and automatically in the background to maintain local mirrors of remote directory trees. In Windows 2000, use the AT command, or use the SOON command with the Windows 2000 Schedule service. (The SOON command runs Soon.exe, a Windows® 2000 Resource Kit tool named Near-Future Command Scheduler.)

By default, the Schedule service logs on as the system account for the local system, which has no network access. Scheduled jobs run in the same context as the Schedule service. To run a scheduled Robocopy job, however, Robocopy must connect to network drives, which requires some additional configuration. The following sections describe two ways to accomplish this.
Using the Local System Account

You can leave the Schedule service running in the context of the local system account. You can then schedule batch files by using the following commands:

NET USE \\remoteserver\IPC$ /USER:userid password
ROBOCOPY \\remoteserver\sourcepath \\localserver\destpath ...
NET USE \\remoteserver\IPC$ /DEL

3 comments:

Wyatt Wong said...

I create a batch file as follows:

rcopy.bat

net use \\sourceserver\robocopy /user:
"C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" \\sourceserver\robocopy\ \\targetserver\robocopy\ /MIR /MON:1 /LOG+:c:\rcopy.log

I setup the Windows Schedule task in Windows Server 2003 to run at System Startup, when I reboot the server and then login, I found the robocopy.exe cannot access the \\sourceserver\robocopy\ folder. Here is an extract from the rcopy.log file:

----------begin----------

-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows :: Version XP010
-------------------------------------------------------------------------------
Started : Thu Aug 05 12:53:03 2010
2010/08/05 12:53:03 ERROR 53 (0x00000035) Getting File System Type of Source \\sourceserver\robocopy\
The network path was not found.

Source - \\sourceserver\robocopy\
Dest : \\targetserver\robocopy\
Files : *.*

Options : *.* /S /E /COPY:DAT /PURGE /MIR /MON:1 /R:1000000 /W:30
------------------------------------------------------------------------------
2010/08/05 12:53:03 ERROR 53 (0x00000035) Accessing Source Directory \\sourceserver\robocopy\
The network path was not found.
Waiting 30 seconds... Retrying...
2010/08/05 12:53:34 ERROR 1326 (0x0000052E) Accessing Source Directory \\sourceserver\robocopy\
Logon failure: unknown user name or bad password.
Waiting 30 seconds... Retrying...
2010/08/05 12:54:08 ERROR 1326 (0x0000052E) Accessing Source Directory \\sourceserver\robocopy\
Logon failure: unknown user name or bad password.
Waiting 30 seconds... Retrying...
----------end----------

How do I resolve this ?

Anonymous said...

Well,
in the net use you must specify a drive letter.

Then in the robocopy you must use that drive letter as source

Unknown said...

Try and download " Long Path Tool " is also useful in situations where you see these