Link to home
Start Free TrialLog in
Avatar of detox1978
detox1978Flag for United Kingdom of Great Britain and Northern Ireland

asked on

EXE Run When Clicked But Not on Scheduled Task

Hi All,

I have a .exe that is stored in C:\BCP\scripts\setup.exe, which runs on a Windows Server 2012 R1

It does a couple things

  • Move Files in C:\BCP
  • Copy Files in C:\BCP 
  • Rename Files in C:\BCP 
  • Create Files in C:\BCP 

When i double click it everything works as expected.  But when i run it via a scheduled task it errors.

I suspect its a permission issue, but cant see any errors.

Any suggestions.


Many thanks
D
ASKER CERTIFIED SOLUTION
Avatar of DEMAN-BARCELO (MVP) Thierry
DEMAN-BARCELO (MVP) Thierry
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What does the scheduled task error message say?
You have two places to look for :

- The history tab in the properties of the task


User generated image
The error code (Last Run Result) on the task : (It's the error code given by the last command executed by the task).

User generated image
Avatar of detox1978

ASKER

Hi All,

The task runs and i can see the .exe is added to task manager.  But it doesnt do what it does when manually clicked.

When the task runs it logs everything that would normally be logged, it just doesnt seem to run as expected...

User generated image
 
Managed to get it sorted.

It was a permissions issue.
I see that the first task is to move files.
From where?
From/for a specific user ?
Are you sure that the program/executable has all the necessary environment (variables, patch, permissions)?
Some programs need the graphical interface to work correctly.
Does it display something when run interactively?
I'm not sure.  The .exe must require network authentication of some kind.

I tried moving the file, using a local user without any luck
I tried moving the file, using a local user without any luck
It is complicated to use the network with a local account. It often means to indicate login/password (in the script/code) which is a bad idea.
In that case, the only thing is setting a login/password on the task. (Take care in case of password changes).
You might want to try running the command under a specific user account.  It’s configurable in task property page.

Cheers,

Lawrence