How to create a scheduled task under SYSTEM user account with SCHTASKS

懵懂的女人 提交于 2019-11-29 07:56:59

问题


I am currently trying to get SCHTASKS to create a scheduled task under the SYSTEM account, by using the following command:

schtasks.exe" /s "\\" /u "SYSTEM" /Create /SC DAILY /MO "7" /ST "12:00" /TN "mytask" /TR  "C:\test.exe "C:\""

Although it outputs:

ERROR: User credentials are not allowed on the local machine.

回答1:


  1. Open an elevated (admin) command prompt.

  2. Enter the following command:

    schtasks.exe /s "\" /ru "SYSTEM" /Create /SC DAILY /MO "7" /ST "12:00" /TN "mytask" /TR "C:\test.exe "C:\"

Please note the difference is that, in order to specify the SYSTEM account, you need to use the /RU switch and not the /U one.




回答2:


  1. Create your tasks in scheduler them export them as XML (https://superuser.com/questions/1334495)
  2. Create a text file with: schtasks.exe /create /RU SYSTEM /TN "Folder\TaskName" /XML "I:\Location\TaskName.xml" as many lines as you want, with each task, then save file as batch (.bat), run as administrator (right click run as admin).
  3. Apply to computers that you want to run it on.


来源:https://stackoverflow.com/questions/6477807/how-to-create-a-scheduled-task-under-system-user-account-with-schtasks

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