How to set “run only if logged in” and “run as” with TaskScheduler in C#?

百般思念 提交于 2019-12-04 16:31:53

Ok there is the solution:

The register task definition call needs to have its TaskLogonType set to Interactive Token. Just setting the TaskDefinition Principal Logon type to use an interactive Token will not work.

RunOnlyIfLoggedOn appears to only work for earlier versions of the task scheduler (v1, on systems like w2k3, etc)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!