Im writing an application that gets installed to c:\programfiles(x86) and when installed by the MSI, it sets up a scheduled task to run the app on login with the following CMD call.
[SystemFolder]SCHTASKS.EXE /create /sc ONLOGON /tn APPNAME /tr [APPLICATIONROOTDIRECTORY]APPNAME.exe -l autorun /rl HIGHEST /f /ru interactive
This creates a task that when viewed in TaskScheduler UI has the "security option" -> "When running the task, use the following user account: INTERACTIVE"
I am trying to replicate that behavior in C# when the application is running to enable/disable that scheduled task.
So far, all I can find is how to set things to run as system, but in that case the applications UI doesn't appear. Can you help me replicate this cmd line functionality in c# code? I believe its the "/ru interactive" part of the command that I'm having trouble replicating.
Im writing an application that gets installed to c:\programfiles(x86) and when installed by the MSI, it sets up a scheduled task to run the app on login with the following CMD call.
[SystemFolder]SCHTASKS.EXE /create /sc ONLOGON /tn APPNAME /tr [APPLICATIONROOTDIRECTORY]APPNAME.exe -l autorun /rl HIGHEST /f /ru interactive
This creates a task that when viewed in TaskScheduler UI has the "security option" -> "When running the task, use the following user account: INTERACTIVE"
I am trying to replicate that behavior in C# when the application is running to enable/disable that scheduled task. So far, all I can find is how to set things to run as system, but in that case the applications UI doesn't appear. Can you help me replicate this cmd line functionality in c# code? I believe its the "/ru interactive" part of the command that I'm having trouble replicating.
Thanks