Closed dickxuwen closed 2 years ago
// Create definition
TaskDefinition td = TaskService.Instance.NewTask();
// Set the run level to the highest privilege
td.Principal.RunLevel = TaskRunLevel.Highest;
// These settings will ensure it runs even if on battery power
td.Settings.DisallowStartIfOnBatteries = false;
td.Settings.StopIfGoingOnBatteries = false;
It works. Thank you very much!
@.***
From: David Hall Date: 2021-11-29 11:13 To: dahall/TaskScheduler CC: dickxuwen; Author Subject: Re: [dahall/TaskScheduler] How to start my task in admin (Issue #923) // Create definition TaskDefinition td = TaskService.Instance.NewTask(); // Set the run level to the highest privilege td.Principal.RunLevel = TaskRunLevel.Highest; // These settings will ensure it runs even if on battery power td.Settings.DisallowStartIfOnBatteries = false; td.Settings.StopIfGoingOnBatteries = false; — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
How to start a scheduled task with the highest permission?
How do I make a scheduled task run without AC power?