Running RoboCopy as a Schedueled Task

Hello,

First time posting a question on Experts Exchange so i apologize if this is a long post firsthand.

I am trying to setup Robocopy as a Scheduled Task. When it runs when i am logged off my Windows 2008 server all that happens is the Files from the Source that i create as test files get deleted and nothing is copied. If i run the batch file normally while logged in it runs correctly and files are copied over. I am newish to Robocopy so i want to make sure i am putting in the command correctly with correct syntax and switches. Please review below and let me know if more info is needed and what other suggestions you might have. Also i am testing this in a Windows 2008 environment but the task has to be in a Windows 2003 environment unfortunately i can't test from that environment as of yet

Robocopy command: robocopy E:\TEMP \\192.168.XXX.XX\e$\Test /copyall /e /r:2 /w:5 /log+:c:\Logs\log.txt

Log File last result from Scheduled task logged off and afterwards what i receive when running it normally logged on:

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Tue Sep 04 10:43:57 2012

   Source : E:\TEMP\
     Dest : \\192.168.XXX.XX\e$\Test\

    Files : *.*
         
  Options : *.* /S /E /COPYALL /R:2 /W:5

------------------------------------------------------------------------------

                         0      E:\TEMP\
      *EXTRA Dir        -1      \\192.168.XXX.XX\e$\Test\2\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         1
   Files :         0         0         0         0         0         0
   Bytes :         0         0         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

   Ended : Tue Sep 04 10:43:57 2012
_________________________________________________________________________________________
-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Tue Sep 04 11:08:18 2012

   Source : E:\TEMP\
     Dest : \\192.168.XXX.XX\e$\Test\

    Files : *.*
         
  Options : *.* /S /COPYALL /R:2 /W:5

------------------------------------------------------------------------------

                         0      E:\TEMP\
                         3      E:\TEMP\2\
      *EXTRA Dir        -1      \\192.168.XXX.XX\e$\Test\2\test\
        *EXTRA File                   54      test1.txt
        New Dir          0      E:\TEMP\2\jontest\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         3         1         2         0         0         1
   Files :         3         0         3         0         0         1
   Bytes :   161.2 k         0   161.2 k         0         0        54
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

   Ended : Tue Sep 04 11:08:18 2012
MB_IT_SupportAsked:
Who is Participating?
 
nappy_dThere are a 1000 ways to skin the technology cat.Commented:
Make sure that you set Robocopy to run as system and not as user.
0
 
David Johnson, CD, MVPOwnerCommented:
personally I'd use a batch file and call the batch file otherwise it looks fine to me.

net use z: /d
net use z: \\192.168.xxx.xxx\e$
if errorlevel  0 goto startcopy
echo "net use failed" >>c:\Logs\log.txt
goto end
:startcopy
robocopy E:\TEMP z:\Test /copyall /e /r:2 /w:5 /log+:c:\Logs\log.txt
if errorlevel 0 goto end
echo "robocopy generated an error>> c:\logs\log.txt
:end
net use z: /d

Open in new window



you may have to add login parameters for the net use command or the script will stall
0
 
MB_IT_SupportAuthor Commented:
I was able to get my original application working but will take notes on these solutions as i will use Robocopy again.

Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.