Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: Is there a way to find the logged in user's "domain\name" when creating a task in code running as SYSTEM?

$
0
0
Glad you figured it out. Just some thoughts on code optimizations:
// If just creating a default TaskService (new TaskService()), use TaskService.Instance instead. You can then avoid the 'using' clause.
TaskService ts = TaskService.Instance;

// Use this statement to get a folder that may have not been created.
TaskFolder tf = ts.RootFolder.GetFolder(folderName) ?? ts.RootFolder.CreateFolder(folderName);

// All triggers set StartBoundary to DateTime.Now in the constructor so you could write:
td.Triggers.Add(new DailyTrigger { Enabled = false });

// You don't need to explicitly add ExecAction. Instead you can write:
td.Actions.Add(targetPathDir + "\\LunaSleep.exe");

Viewing all articles
Browse latest Browse all 2206

Trending Articles