在 Windows 中以编程方式创建计划任务 - 0x8004130f 错误
我在运行计划任务时遇到重大问题。 使用 Microsoft 提供的 ITaskScheduler 接口可以很好地创建任务。 该任务设置为仅在用户登录时运行。
问题是任务没有运行,日志文件 SchedLgU.txt 引用的原因是:
"The attempt to retrieve account information for the specified task failed; therefore, the task did not run. Either an error occurred, or no account information existed for the task.
The specific error is:
0x8004130f: No account information could be found in the Task Scheduler security database for the task indicated."
我知道可以在没有帐户信息的情况下创建计划任务,因为 Google Updater 计划任务会执行此操作,并且它会运行美好的。
我从网络搜索中得到的信息是,Windows 有一个“计划任务数据库”,每个任务都需要有凭据信息才能运行。
有谁知道如何修改此凭据数据库或任何其他方式来运行我的任务?
I am having major problems getting a scheduled task to run. The task is created fine using the ITaskScheduler interface provided by Microsoft. The task is set to run only if a user is logged on.
The problem is that the task does NOT run and the log file SchedLgU.txt cites the reason as being:
"The attempt to retrieve account information for the specified task failed; therefore, the task did not run. Either an error occurred, or no account information existed for the task.
The specific error is:
0x8004130f: No account information could be found in the Task Scheduler security database for the task indicated."
I know for a fact that a scheduled task can be created with no account information because the Google Updater scheduled task does this, and it runs fine.
All I can gather from web searches is that Windows has a "scheduled task database" that needs to have credential information for each task for it to be able to run.
Does anyone know how to modify this credential database or any other way to get my task to run?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
GoogleUpdateTaskMachine 任务使用“NT AUTHORITY\SYSTEM”来运行任务。 您可以通过使用 schtasks 命令和 /ru 开关以及“System”或“”作为参数来完成此操作。 像这样:
它不会提示输入密码。
有关详细信息,请参阅 technet。
The GoogleUpdateTaskMachine Task uses the "NT AUTHORITY\SYSTEM" to Run the task. You can do this by using schtasks command and the /ru switch with "System" or "" as the parameter. Like this:
It does not prompt for a password.
See technet for more info.
您可以使用批处理脚本。
就这样吧。
阅读:如何使用 Schtasks.exe 在 Windows Server 2003 中计划任务
you could use batch scripting.
there you go.
read: How to use Schtasks.exe to Schedule Tasks in Windows Server 2003
据我所知,并且文档支持了这一点,计划任务需要一个帐户。 如果您将任务设置为仅在用户登录时运行,这仅意味着不需要密码,您仍然需要一个帐户。 可以将该帐户设置为一个组,这样只要该组中的任何人登录,该任务就会在触发时运行。 例如,您可以将帐户设置为“用户”,以便任何人登录时都可以运行任务。
As far as I know, and the documentation backs this up, an account is required for a scheduled task. If you set the task to run only when a user is logged in that only means a password is not necessary, you still need an account. This account can be set to a group so that the task will be run when it is triggered as long as anyone in the group is logged on. For instance you can set the account to 'Users' so that the task can run when anyone is logged on.