Scheduled task calls EXE file does not work.

On a Windows 2012 server, I create a Scheduled Task to run a EXE file.  

The EXE file creates CSV files in a network share.  

When I manually run the EXE, it works.  But when I call it from the Scheduled Task and run the task, it just does not run and returns an error about access issue.  

I am running the task as a domain admin who has right to that network share.  

I do not know what else to check.  I search the WEB and see a lot of people have similar issue.  I have tried what have been suggested but still have no luck of getting it to work.

Anyone has any suggestion is appreciated.  

Thanks in advance.
nav2567Asked:
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.

NinjaStyle82Systems AdministratorCommented:
are you pointing to the network share by UNC path or drive letter?
0
ste5anSenior DeveloperCommented:
Well, Scheduled Tasks run under a different account. Per default a local account without any network permissions. Even when you have used a different account, do you use a mapped drive? This is normally also not available under a different account.

So use an account with network permissions and access your file by using a UNC path.
0
nav2567Author Commented:
The EXE drops file to a UNC path.  The account being used to run the task has R/W right to the UNC path.  

Thanks.
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

NinjaStyle82Systems AdministratorCommented:
Is the EXE located in a place where this account has permission as well? like not in a different user's profile on the server or anything, correct?

Sometimes explicit permission needs to be granted in Windows Server to profiles, even though inherently they should have permission.
0
Wayne88Commented:
From a post here: https://social.technet.microsoft.com/Forums/windowsserver/en-US/d47d116e-10b9-44f0-9a30-7406c86c2fbe/scheduled-task-wont-run-bat-file?forum=winservermanager

I wanted to summarize all of the steps I performed to solve my problem.  I would guess that maybe some of these are not needed, but I'll list them all to hopefully help you get it working

1) Make sure that the task is set to "configure for Windows Vista or Windows 2008" on the first page of the task properties (under the "general" tab)
2) Make sure that the task is set to "start in" the folder that contains the batch file: open the task properties, click on the "actions" tab, click on the action and then the "edit" button at the bottom.  In the "Edit Action" Window there is a field for "start in (optional)" that you set to the path to the batch file.
3) Make sure that the task is running as an account that has explicit "Full access" permissions to all these things:  The .bat file itself,  the folder containing the .bat file, and the target files/folders that are affected by the .bat script.  Inherited permissions didn't seem to work for me.
4) Make sure that the account running the task is a member of the local "administrators" group for this machine
5) Make sure that the task is set to "run whether logged on or not"
6) The Task should run successfully with expected output when you right-click on the task and select "run"  If it does that then it will run successfully when you are logged off.

Good Luck!
0
ste5anSenior DeveloperCommented:
To check whether you have sufficent UNC/network permissions, run dir \\UNC\share\ > echo c:\Temp as command of your task. Ensure that a c:\temp exists and with full permissions for everyone.
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
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 2012

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.