File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,18 +129,16 @@ public StartupManager()
129129 private void CreateSchedulerTask ( )
130130 {
131131 ITaskDefinition definition = _scheduler . NewTask ( 0 ) ;
132- definition . RegistrationInfo . Description =
133- "This task starts the Open Hardware Monitor on Windows startup." ;
134- definition . Principal . RunLevel =
135- TASK_RUNLEVEL . TASK_RUNLEVEL_HIGHEST ;
132+ definition . RegistrationInfo . Description = "This task starts the Open Hardware Monitor on Windows startup." ;
133+ definition . Principal . RunLevel = TASK_RUNLEVEL . TASK_RUNLEVEL_HIGHEST ;
136134 definition . Settings . DisallowStartIfOnBatteries = false ;
137135 definition . Settings . StopIfGoingOnBatteries = false ;
138136 definition . Settings . ExecutionTimeLimit = "PT0S" ;
139- _ = ( ILogonTrigger ) definition . Triggers . Create ( TASK_TRIGGER_TYPE2 . TASK_TRIGGER_LOGON ) ;
137+ var trigger = ( ILogonTrigger ) definition . Triggers . Create ( TASK_TRIGGER_TYPE2 . TASK_TRIGGER_LOGON ) ;
138+ trigger . UserId = WindowsIdentity . GetCurrent ( ) . Name ;
140139 IExecAction action = ( IExecAction ) definition . Actions . Create ( TASK_ACTION_TYPE . TASK_ACTION_EXEC ) ;
141140 action . Path = Application . ExecutablePath ;
142- action . WorkingDirectory =
143- Path . GetDirectoryName ( Application . ExecutablePath ) ;
141+ action . WorkingDirectory = Path . GetDirectoryName ( Application . ExecutablePath ) ;
144142
145143 ITaskFolder root = _scheduler . GetFolder ( "\\ " ) ;
146144 ITaskFolder folder ;
You can’t perform that action at this time.
0 commit comments