run exe as system account

后端 未结 3 864
执念已碎
执念已碎 2021-01-14 05:05

I am trying to run my c# exe as an system account. How can I do that. I\'ve tried and

3条回答
  •  無奈伤痛
    2021-01-14 05:55

    It's not directly possible. There are hacky ways if you are an administrator (like getting the security token from an already running service or something), but I far from recommend using those.

    The point of the SYSTEM account is precisely that: that it's only run directly by the system.

    If you want an easy-hacky-way without third-party tools (like psexec), you could set up a ONEEVENT scheduled task (with schtasks, which is part of the OS), which can indeed run with the system account. This would still need two processes (although it could be the same exe with different command line parameters for the task and for setting it up), but it'd work.

提交回复
热议问题