Scheduled task not running on Windows Server 2008 but working on Windows XP
Hi,
I have created a console application using .NET 3.5 framework for fetching data from the oracle database and sending it as an attachment via email.
Using the task scheduler I have scheduled a task to run the console application's .exe file at 9 AM every day.
The task is scheduled properly and works fine on a Windows XP machine and doesn't work on windows 2008 server.
When the task is run for the first time on XP and installation prompt is displayed. Once the installation is done from the next time onwards the task is getting executed as scheduled without any issues.
In case of windows server 2008, I did not get any installation prompt, so I went ahead and double clicked the .exe file to install it on the server and scheduled it. I am getting a 'success' message every time it executes, but the data is not being sent
as a mail which means the .exe program is not executed. I have used domain credentials as well as the machine's administrator credentials to verify this.
I have also checked the firewall settings and there is no issue with it as it is turned off.
I have checked the logs in event viewer, but no error messages have been logged.
Please let me know if there is a solution to this issue.
Thank you.
Regards,
Badarinath Pennati.
September 8th, 2010 9:15am
September 8th, 2010 3:00pm
Hi Tom,
Thanks for the reply. The KB suggested by you does not contain the solution for my issue. I have tried creating the task from command prompt. The task gets scheduled properly when created from the command prompt or through user interface.
But when the task is run I am still getting the message as "The operation completed successfully. (0x0)" without the task getting executed completely. I have placed a log statement at the start of the program, and no information is logged which
means the program is not invoked by the scheduler. This issue occurs only in Windows Server 2008.
Since I am not using the command prompt for executing the service, I don't think the hot fix suggested in the above KB holds good.
-
Edited by
Badrinath Pennati
Thursday, September 09, 2010 2:47 AM
September 9th, 2010 12:09am
Hi Tom,
Thanks for the reply. The KB suggested by you does not contain the solution for my issue. I have tried creating the task from command prompt. The task gets scheduled properly when created from the command prompt or through user interface.
But when the task is run I am still getting the message as "The operation completed successfully. (0x0)" without the task getting executed completely. I have placed a log statement at the start of the program, and no information is logged which
means the program is not invoked by the scheduler. This issue occurs only in Windows Server 2008.
Since I am not using the command prompt for executing the service, I don't think the hot fix suggested in the above KB holds good.
-
Edited by
Badrinath Pennati
Thursday, September 09, 2010 2:47 AM
September 9th, 2010 12:09am
On the properties of the task that was created in the Task Scheduler, what do you have selected in the Configure for section. Is it the option Windows Vista, Windows Server 2008?
Also, under the Security Options of the task in the General tab, can you choose the following option
Run with highest Privileges then confirm if it exectues successfully.
If it is still failing after trying the above, then as a test can you try the following adding the scheduled task in the Startup folder (C:\Users\<admin_acct>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup) and see if it exectues successfully.
Regards,
Tom
September 9th, 2010 2:14am
Hi Tom,
Thanks again!
In the configure section I have selected 'Windows Vista, Windows Server 2008' option.
Currently I am using the 'run with highest privileges' option in my task because of which I am getting 'The operation completed successfully' message, else I used to get an error log in event viewer even when the task is executed successfully.
Following is the log data:
Log Name: System
Source: Microsoft-Windows-DistributedCOM
Date: 9/1/2010 9:00:02 AM
Event ID: 10016
Task Category: None
Level: Error
Keywords: Classic
User: DMNNAME\UsrName
Computer: server1.win.excera.net
Description:
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID
{33246F92-D56F-4E34-837A-9A49BFC91DF3}
to the user DMNNAME\UsrName SID (S-1-5-21-1535773150-520773558-1539857752-506717) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-DistributedCOM" Guid="{1B562E86-B7AA-4131-BADC-B6F3A001407E}" EventSourceName="DCOM" />
<EventID Qualifiers="49152">10016</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2010-09-01T13:00:02.000Z" />
<EventRecordID>80832</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>System</Channel>
<Computer>server1.win.excera.net</Computer>
<Security UserID="S-1-5-21-1535773150-520773558-1539857752-506717" />
</System>
<EventData>
<Data Name="param1">machine-default</Data>
<Data Name="param2">Local</Data>
<Data Name="param3">Activation</Data>
<Data Name="param4">{33246F92-D56F-4E34-837A-9A49BFC91DF3}</Data>
<Data Name="param5">DMNNAME</Data>
<Data Name="param6">UsrName</Data>
<Data Name="param7">S-1-5-21-1535773150-520773558-1539857752-506717</Data>
<Data Name="param8">LocalHost (Using LRPC)</Data>
</EventData>
</Event>
If I am selecting the 'run with highest privileges' option I am not getting any information logged to the System log.
Even executing the program from the startup of an admin user did not help.
Please note that the application I want to schedule is an .exe file obtained from a .NET 3.5 console application. All the supporting files like config and manifest files are present along with the executable.
September 9th, 2010 3:35am
Hi Tom,
Another observation made. When I double click the .exe file on XP the application is executing and sending an email. But if I do the same on Windows Server 2008, the application is not getting executed.
So, the issue is not with the Task Scheduler. Probably it should be with Server or Network settings.
My UserID has admin access on the Server machine. And I have also used the actual system's administrator credentials to check this issue. In both the cases I am unable to execute the application.
September 9th, 2010 3:49am
Have the same problem.
Have an exe file that is scheduled on the Server 2008 R2. The scheduler starts the process, however, program is not executed. I have no problem scheduling this program in Win XP. Yet, on Server 2008 it looks like a process is created by task scheduler but the
program is not executed.
Would appreciate a help. Tried everything recommended above - does not help
October 25th, 2010 4:18pm
I know its being long time but I had the same problem today, Once i have changed Option to
Run only when usrer is logged on , it worked
-
Proposed as answer by
esteban2800
Sunday, May 20, 2012 4:54 PM
March 28th, 2011 9:18am
I know its being long time but I had the same problem today, Once i have changed Option to
Run only when usrer is logged on , it worked
-
Proposed as answer by
esteban2800
Sunday, May 20, 2012 4:54 PM
March 28th, 2011 9:18am
I have the same problem. I can run a program via Command Line and via .bat file, however, when i schedule this process, the scheduler reports that it has run correctly and without errors, however, the program is not being run. I have tried privilege changes,
different variations on writing the task commends etc. but nothing is working - really need some help on this as it is doing my head in !!
April 15th, 2011 4:53pm
I'm also able to run my executable when I select Run only when usrer is logged on, but I can't stay logged in with the account. Has anyone found a solution?
May 4th, 2011 9:29pm
I had this exact same issue and was able to fix it on my end. My problem was that Server 2008's Task Scheduler defaults to a system directory as the "Start In" path if you don't set one. So even though my task's action was to run D:\websites\site\bin\MyApp.exe,
the exe was being run as if it were in the system directory, preventing it from finding the web.config file it needed to reference. By setting the Start In path manually (under the Action properties) to D:\websites\site\bin, the task started working
perfectly.
-
Proposed as answer by
Prashant Channe
Tuesday, June 28, 2011 11:18 AM
May 20th, 2011 7:45pm
I had this exact same issue and was able to fix it on my end. My problem was that Server 2008's Task Scheduler defaults to a system directory as the "Start In" path if you don't set one. So even though my task's action was to run D:\websites\site\bin\MyApp.exe,
the exe was being run as if it were in the system directory, preventing it from finding the web.config file it needed to reference. By setting the Start In path manually (under the Action properties) to D:\websites\site\bin, the task started working
perfectly.
-
Proposed as answer by
Prashant Channe
Tuesday, June 28, 2011 11:18 AM
May 20th, 2011 7:45pm
Hi Danny
The solution worked for me.
Thanks
Prashant Channe
June 28th, 2011 11:18am
Thank you kindly, DannyBGood.
Changing the "Start In" path did correct this issue for me. :)
September 20th, 2011 12:14am
Thanks Danny, It`s worked for me
-
Edited by
Sdeepsingh
Thursday, September 22, 2011 5:47 AM
September 22nd, 2011 5:46am
Thanks Danny, It`s worked for me
-
Edited by
Sdeepsingh
Thursday, September 22, 2011 5:47 AM
September 22nd, 2011 5:46am
Many thanks! Helped us too.
January 16th, 2012 11:27am
Thanks Danny,
Your solution works form me also.
FDL
May 31st, 2012 1:04pm
The solution worked for me.
Thanks,
James Ward
August 8th, 2012 4:49pm
This was the answer for me too. Initially it did not work, but after moving the executable to a path that did not contain spaces and then entering the path info in the start in directory = voila, success! Using quotes around the path which contained
spaces resulted in an invalid directory error in the event viewer. Thanks for sharing this info.
September 7th, 2012 4:32pm
Thanks Danny,
This worked for me as well.
October 4th, 2012 2:59pm
Thanks! Just spent half a day figuring this one out.
November 15th, 2012 8:23pm
Thanks. Once I set the "Start In" it worked like a charm. My path also had spaces and (), still it worked.
November 28th, 2012 6:53pm
Thank you kindly, DannyBGood.
Changing the "Start In" path did correct this issue for me. :)
"Start In" also works for me.Thank you all.
December 22nd, 2012 7:26am
thanks for the tips, it did solve my problem as well.
July 22nd, 2013 1:57pm
Tks, Its Worked for me too!
October 10th, 2013 2:00pm
Awesome, that did it for me!
December 11th, 2013 1:45pm
Changing the start in property worked perfectly! Thank You!
June 12th, 2014 6:22pm
This helps. After defining the Start In Path, which though is optional, I am able to run the scheduled tasks successfully. Thanks a lot.
August 12th, 2014 2:59am
This worked for me as well. My program kept running as a service but I had the option to "start weather the user was logged on or off". Once I changed that option to "only run if the user is logged on" and I also changed the start in
folder; now my application is starting normally.
April 17th, 2015 11:54pm