cmdcopyscheduled-tasksnetwork-drive

Scheduled task copying problems - no errors


I am building a script that will do database backup and will copy the backup to a safe storage location on another computer. I have that specific location already mounted on Y: and have built my script (.bat). The script runs fine in test runs, but when task scheduler runs it the part in charge of copying:

copy /Y "C:\something or other\Backup.bak" "Y:\DB\DB-%mydate%.bak"

doesn't run. In order to see what is going on when scheduler runs the script I appended

>> backup.log

to every line of the script. When I tried manually running the scrip through task scheduler in order to test what is the problem the only thing copy outputs is:

0 file(s) copied

and nothing else. No other error.

I know that Start Folder set in task could be the problem but I did set it to the folder where the script is. Also start folder shouldn't be an issue since all the time I'm working with full paths.

EDIT: I'm running this on Windows Server 2003 SP2 if it has anything to do with it.

So any ideas what could be the problem?


Solution

  • can you try to map the network drive inside the script or use UNC ? something like

    pushd \\server\path
    copy c:\backup.bak .
    popd