SCHTASKS runs cmd file, but XCOPY in cmd file fails


  • I need to run a command file to copy database backup files to a backup server.  Both server are Windows 2008 R2.  Task does run, but all file copy's fail.  Running the command file manually works.  I have tried creating the task with both of the commands below and made every change to bump priority using GUI that I can see to do and nothing works.

    SCHTASKS /create /tn "Daily Backup to Secondary Server" /tr c:\ADV\Backup\NetCopy.cmd /sc DAILY /st 3:15 /ru "System"

    SCHTASKS /create /tn "Daily Backup to Secondary Server" /tr c:\ADV\Backup\NetCopy.cmd /sc DAILY /st 3:15 /ru "SchAdm" /rp "<pw>"

    SchAdm is a member of administrator group on both server and has permission to read/write to the folders on both servers. 

    Help, please.



    Friday, January 25, 2013 10:42 PM

All replies

  • Grant SchAdm account permission to Log on as a batch job on both the servers.

    Regards, Santosh

    I do not represent the organisation I work for, all the opinions expressed here are my own.

    This posting is provided "AS IS" with no warranties or guarantees and confers no rights.

    Whenever you see a helpful reply, click on Alternate Text Vote As Helpful & click on Alternate Text Mark As Answer if a post answers your question.

    Saturday, January 26, 2013 8:21 AM
  • Thank you, Santosh.  But that did not solve the problem.  The batch file does run correctly, but the network file copy specified in the batch file does not work.  Even xcopy from local drive to same drive, but using the network, fails (D: and \\adv1\D are the same).

    echo f |xcopy "D:\MSSQL\backup\Backup_ADVdb.bak" "\\adv1\D\MSSQL\ADVdb_copy.bak" /D /Y

    The network is local and in a workgroup, not a domain.

    I appreciate any help.


    Tuesday, January 29, 2013 4:47 PM