Click here to Skip to main content
15,886,765 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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 [^]
 
Share this answer
 
sCreateArg = @"/create /S " + @sIPAddress + " /tn " + sSchedulerName + " /tr " + sPath + " /sc " + sScheduleTask.ToLower() + " /st " + sStartTaskTime + " /ru " + sUserName + " /rp " + sPassword;
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900