eTrigger.SetBasic("Security", "Microsoft Windows security auditing.", 4625)
eTrigger.GetBasic()
eTrigger.Subscription
eTRigger.SetBasic("Security", "Microsoft Windows security auditing.", 4625)
class Program { static void Main(string[] args) { using (TaskService ts = new TaskService()) { // Create a new task definition and assign properties TaskDefinition td = ts.NewTask(); td.RegistrationInfo.Description = "Does something"; // Create a trigger that will fire the task at this time every other day // whether user is logged on or not EventTrigger eTrigger = (EventTrigger)td.Triggers.Add(new EventTrigger()); EventLog securityLog = new EventLog("Security", System.Environment.MachineName); //this is where I see problem. I want to use eTrigger.GetBasic eTrigger.SetBasic("Security", "Microsoft Windows security auditing.", 4625); eTrigger.Enabled = true; eTrigger.ExecutionTimeLimit = TimeSpan.Zero; // Create an action that will launch Notepad whenever the trigger fires td.Actions.Add(new ExecAction(@"C:\Windows\notepad.exe")); // Register the task in the root folder ts.RootFolder.RegisterTaskDefinition("test", td); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)