Windows task scheduler error, copy file from samba share to windows server

Hi
I want to copy a file from a linux server, samba share already set up, to a windows server using the task scheduler.  I've mapped a network drive to the samba share, created a .bat file with the xcopy command to copy the file from the samba share(mapped network drive Z) to the local disk on the windows machine.  When I run the .bat file in the command line it is working 100% and the file is copied, but when I add the .bat file to the task scheduler the following error occur : "Backup.job" (Backup.bat)
      Finished 2008/02/11 01:30:00 PM
      Result: The task completed with an exit code of (4).

I've looked up the error code : The system cannot open the file.

Why is it working in command line, but not in the scheduler, I've set up the Administrator password for the task but still returns the same error code.

Thanks
LVL 1
ruanlab123Asked:
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.

dan_blagutCommented:
Hi
did you tried to put the map command in the script before to copy and then to release the maped drive?

Dan
0
dan_blagutCommented:
something like
net use z: \\samba_server\resource
xcopy z:\file dest
net use z:  /delete

Open in new window

0
ruanlab123Author Commented:
Hi Dan

Thanks for the reply, I've tried it - thanks for showing me how to map a network drive like this - but it is still not working.  If I execute the .bat file in the command line, it is working 100% again, but now  in the scheduler it only stay busy, no error code is returned the task is running the whole time.  If I connect to the samba drive through explorer Windows is always asking me for a password, although a password is not needed, you can type anything and press enter and the connection will be allowed, can this be the reason why the task is just running and doing nothing?

Thanks
0
dan_blagutCommented:
Hi
Then you can use
net use z: \\server_samba\share password

when you put a good password or something else if works with any password

Dan
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
ruanlab123Author Commented:
Hi Dan

Thanks for pointing me in the right direction, the scheduler task is working correct now, and the file is copied.  I needed to change one small thing - net use z: \\server_samba\share /USER:user\password

Thanks again for all your help!!
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.