Click here to Skip to main content
12,304,822 members (65,983 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
Dear All,

I want to run one exe("Ex:mymodule.exe") in scheduler task, how to create scheduler task for execute my exe with codeing in c#.net. where i can have option of Daily, Once, Monthly.
When am trying with below code am getting Error: Access Denied
sCreateArg = @"/create /S " + @sIPAddress + " /tn " + sSchedulerName + " /tr "
+ ExePath + " /sc Daily /st " + sStartTaskTime + " /ru " + sUserName;

I have checked with Both Local system username and Password and Remote system username,Password


Thank you In advance
Posted 16-Sep-12 23:48pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I think the best way is creating your own Scheduler.
The windows service is going to help you to implement your project.

Follow the below code for more info about Windows Service:

Introduction to Windows Service Applications [^]
How to run a process from the Windows service [^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

sCreateArg = @"/create /S " + @sIPAddress + " /tn " + sSchedulerName + " /tr " + sPath + " /sc " + sScheduleTask.ToLower() + " /st " + sStartTaskTime + " /ru " + sUserName + " /rp " + sPassword;
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160530.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100