Click here to Skip to main content
11,480,938 members (45,154 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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 17-Sep-12 0:48am
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
0 Sergey Alexandrovich Kryukov 294
1 OriginalGriff 145
2 CHill60 130
3 CPallini 125
4 Richard MacCutchan 75
0 Sergey Alexandrovich Kryukov 8,184
1 OriginalGriff 7,586
2 Sascha Lefèvre 3,114
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2015
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