Windows Task Scheduler donesn't run my backup script

Dear Experts,

I have a backup scrip that should backup data from local server to a shared drive.  the script shown under the code.  under Task Scheduler i set it to run at 10:00PM, even if user not logged on.  Under Task scheduler even it shows that task was run successfully but I don't see any backed up data?  if i double click the script it will run and make a copy of my data.

any ideas?


@echo off
title BACKING UP NOW...
set Source=E:\sourcedata
set Target=Z:\backup
set CopyCMD=xcopy /d /i /r /k /c /h /e /v /y
:: See XCOPY switches explained at:
:: support.microsoft.com/kb/289483
set Year=%date:~10,4%
set Month=%date:~7,2%
set Day=%date:~4,2%
mkdir %Target%\%Year%\%Month%\%Day%
%CopyCMD% %Source% %Target%\%Year%\%Month%\%Day%
cls
exit

Open in new window

uknet80Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Krzysztof PytkoSenior Active Directory EngineerCommented:
You said that task is run and completed undet Task Scheduler but nothing has happened. Please check if at least folders were created. For me it looks like task runs properly but insuficient rights to do the script.

Does scheduled task run on an account with appropriate credentials to read data from source directory and copy/overwrite it in target directory? Please ensure if that task is run on appropriate account.

Regards,
Krzysztof
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hrr1963Commented:
Also you may want to save the output messages to a log file.

%CopyCMD% %Source% %Target%\%Year%\%Month%\%Day% >> logFile.txt

Now, you can verify the log file to check if it really executed without problems.
0
Gerwin Jansen, EE MVETopic Advisor Commented:
You should realize that a scheduled task that runs 'even if the user is not logged on' has no rights on the shared drive (Z) in your batch file. The other thing is that Z: does not even exist when the task is triggered. I'd suggest that you use a UNC path instead of Z: and configure the scheduled task with a username and password that has access to the UNC path that is being copied to.
0
uknet80Author Commented:
the solution was access to remove share drive:

this doesn't work
set Source=E:\sourcedata
set Target=Z:\backup


but this does
set Source=E:\sourcedata
set Target=\\server_IP_address\backup

thanks for your helps
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.

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.