Windows scheduled task and shared drive mapping

Hi,
I am using scheduled task to schedule one of my batch file to delete files from a shared drive. When scheduled this file is returning errors "access denied". If I run the same batch file as logged in user, it all goes fine.

Does scheduled task run as user who submit task or run as system internal user?
How do I get shared mapping working thru batch script without revealing the password?

Many Thanks
crazywolf2010Asked:
Who is Participating?
 
helpfinderConnect With a Mentor IT ConsultantCommented:
yop, best would be to use net use command in the script (or just do not specify in the command disk drive you have mapped but UNC path, e.g. \\fileserver\myshare)
0
 
helpfinderIT ConsultantCommented:
for rhis you couold create service account in AD and set to run scheduled task under this credentials. (of course you have to set permission for that user on shared folder)
For service account you can follow this MS basics:
http://technet.microsoft.com/en-us/library/cc739458%28v=ws.10%29.aspx
0
 
crazywolf2010Author Commented:
Hi,
I don't have domain account with all privs. I wish to do it thru a machine admin account. I have domain account for mapping shared drive with limited privs.

Thanks
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
helpfinderIT ConsultantCommented:
but if shared folder has set NTFS/share permission (they are cumulative) which does not allow local users (even admins) to modify (delete) its content you won´t be able to achieve this.
You has to work with account  (set schedule task to un under this account) which has privilege to modify contend of your desired shared folder.
0
 
crazywolf2010Author Commented:
Hi Mate,
Probably I didn't write my setup clearly, here are the details.

I have a machine admin user "admin" with all privs
I then have a Domain user with only limited privs to "SHARE" as "user"

Once I login at machine, I use net share command and use "user" credentials to map shared drive. I can run commands manually and they do work fine.

How do I replicate it at scheduled task?

Regards
0
 
helpfinderConnect With a Mentor IT ConsultantCommented:
then you have to run the task under user account which is able to run it also when you are logged as that user - see printscreen (green line and Administrator account)
scheduled.PNG
0
 
crazywolf2010Author Commented:
Hi,
I don't want user to login to fire this task. It's spooling,copying files at 5am.
Can I schedule it thru scheduled task but then the challenge is mapping shared drive.

Thanks
0
 
helpfinderIT ConsultantCommented:
the task is scheduld and will be proceed automatically at desired time and date under defined user credentials and with his permissions - no need to be logged as that user, it is enough to have PC powered on.
0
 
crazywolf2010Author Commented:
That's great. I will test.
How does network share mapping will work under such scenario? Do I need to map that share on the machine explicitly after reboot? OR I have to use net use command within script?

Thanks
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.