Scheduled Task not running properly in the background

I am trying to move some scheduled tasks from a windows server 2003 server to a 2008 r2 server. I copied the tasks exactly. There are two programs that are supposed to run. 1 gathers statistics and creates 3 excel files. 2. Sends the files to certain distros. The programs work fine when i run them manually but when i run them as a scheduled task it looks like it's running in processes but the excel files aren't created and no email is sent.

I have tried running as "highest privilege"  it also seems to work if i select "run only if user is logged in" but i cannot always stay logged in.

I'm lost please help.

Josef
LVL 3
JoeSystems AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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

Tim PhillipsWindows Systems AdministratorCommented:
Just a thought, but you could try running it with the "system" user account.
NVITEnd-user supportCommented:
What does your manual command line look like? e.g.
program.exe arg1 arg2

The task's Action settings would be...
Program/script: program.exe
Add arguments: arg1 arg2

If you are using CMD.EXE, the task's Action settings would be...
Program/script: cmd.exe
Add arguments: /c arg1 arg2
Russ SuterSenior Software DeveloperCommented:
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Steven CarnahanNetwork ManagerCommented:
I have seen some batch files run as scheduled task not work unless the "Start In" is filled in.
JoeSystems AdministratorAuthor Commented:
I could try running as system. I am running as a domain admin though I'd think that would be enough.

I am running as a domain admin. I have also tried running as a local administrator account as well
JoeSystems AdministratorAuthor Commented:
Hmm.. i will try the arguments. Didn't think of that.
NVITEnd-user supportCommented:
Correction to my post ID: 40885511

If you are using CMD.EXE to run a .bat file, the task's Action settings would be...
Program/script: cmd.exe
Add arguments: /c program.bat arg1 arg2
JoeSystems AdministratorAuthor Commented:
Oh wait no the first program is an exe file. It looks like it's using a config file for instruction though.

Josef
Joe MikaCommented:
Is the config file or anything that it is supposed to be creating on a mapped drive.  You may need to use a UNC path instead...
JoeSystems AdministratorAuthor Commented:
No it's not creating a mapped drive. It looks like it is running everything locally.


Josef
Steven CarnahanNetwork ManagerCommented:
Have you tried what I suggested:  

I have seen some batch files run as scheduled task not work unless the "Start In" is filled in.
JoeSystems AdministratorAuthor Commented:
Yes i am sorry i did not see that. Start in is filled in.

Josef
JoeSystems AdministratorAuthor Commented:
The program is running. Just it runs in the background and since it is doing so it doesn't seem to do what it's intended to do. When it runs in the foreground it works okay.

Josef
Steven CarnahanNetwork ManagerCommented:
Normally that is a permission issue.  If it is opening a CMD window then verify that the user that is running the task has read/execute permissions to the cmd.exe file located in C:\Windows\System32.
JoeSystems AdministratorAuthor Commented:
It does. I am a domain and local admin. I also set the task to run as highest privilege. Unless there is another setting that i do not know about.
NVITEnd-user supportCommented:
Josef,

Have you tried the UNC suggestion by Joe at ID: 40889735. I don't know how your program is written/setup, or if you have the option of fixing it.

If your program assumes the mapped drive exists, you may need to revise it. One option is to create the mapping in your program. That way, you know the mapped drive is there. Another is to replace the mapped drives with the full path.
Steven CarnahanNetwork ManagerCommented:
I agree with Josef and Joe.  If you are trying to use a mapped drive it won't work.  Remember drives are mapped at logon so if you run a program using a mapped drive when not logged in there will be no mapped drives.  Hard to answer properly without the actual code to look at.
JoeSystems AdministratorAuthor Commented:
i think that i found the answer. I will get back with you all in the next day or so. Testing is in progress.
JoeSystems AdministratorAuthor Commented:
It was a dumb fix honestly. I spoke with the developer who wrote the program. He debugged the program and saw that it was having an issue finding a cell in excel. Soo.. He googled the fix and it was to go to C:\Windows\SysWOW64\config\systemprofile and create a folder called desktop... That's it.

Josef

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
Steven CarnahanNetwork ManagerCommented:
Josef,

Glad you figured that out.  Seems like a strange but common issue. I did a search and found lots of hits with the same solution that worked for most scenarios. There was also a registry hack mentioned but this seems the easier/safer method. One more tool to add to the chest.  :)
JoeSystems AdministratorAuthor Commented:
Thanks for all the help.
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 2008

From novice to tech pro — start learning today.