尝试使用任务计划程序 (Win7) 注册任务时出错 [英] Error when trying to register a task with task scheduler (Win7)

查看:69
本文介绍了尝试使用任务计划程序 (Win7) 注册任务时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了使我的应用程序能够在用户登录时以管理员权限启动,我在任务调度程序中使用了一个任务.它工作正常.大多.现在我收到错误报告说这失败了:

To enable my application to startup with admin rights at user login, I use a task in task scheduler. And it works fine. Mostly. Now I've received bug reports saying that this fails:

rootFolder->RegisterTaskDefinition( _bstr_t(name.toWideCharPointer()), task,              
   TASK_CREATE_OR_UPDATE, _variant_t(L"Builtin\\Administrators"), _variant_t(), 
   TASK_LOGON_GROUP, _variant_t(L""), &registeredTask) -> 0x80070534

0x80070534 似乎意味着未完成帐户名称和安全 ID 之间的映射".我正在关注(几乎是逐字逐句)以下示例:http://msdn.microsoft.com/en-us/library/aa381911(v=VS.85).aspx

0x80070534 seems to mean "No mapping between account names and security IDs was done". I'm following (pretty much verbatim) the example at: http://msdn.microsoft.com/en-us/library/aa381911(v=VS.85).aspx

想法出了什么问题,以及如何解决?该应用程序已设置清单,因此用户需要以管理员身份运行它.

Ideas what has gone wrong, and how to fix it ? The application has manifest set so the user needs to be admin to run it.

问题:Builtin\\Administrators"组,它依赖于语言,不是吗?我认为有问题的用户可能有非英语的 Windows 7.如果是这样,我想它会更好地指定S-1-5-32-544"( http://support.microsoft.com/kb/243330 )

Question: The "Builtin\\Administrators" group, it is language dependent, isn't it ? I think that the user in question might have a non-english Windows 7. If so I imagine it would work better with specifying "S-1-5-32-544" instead ( http://support.microsoft.com/kb/243330 )

更新:所以显式调用看起来像:

Update: So the explicit call looks like:

rootFolder->RegisterTaskDefinition(
            _bstr_t(name.toWideCharPointer()),
            task,
            TASK_CREATE_OR_UPDATE,
            _variant_t(L"S-1-5-32-544"),    // Language independent "BUILTIN\Administrators" 
            _variant_t(),
            TASK_LOGON_GROUP,
            _variant_t(L""),
            &registeredTask)

确保以提升的权限执行应用程序,否则调用将失败.

Make sure that the application is executed with elevated privileges, otherwise that call will fail.

推荐答案

花了一些时间后,我发现除了 _variant_t(L"S-1-5-32-544") 需要使这个 "登录触发器示例 (C++)" 示例 工作.

After spending some time, I've seen that more modifications than just _variant_t(L"S-1-5-32-544") are needed to make this "Logon Trigger Example (C++)" example work.

所有细节都可以在这个答案中找到.

All the details can be found in this answer.

这篇关于尝试使用任务计划程序 (Win7) 注册任务时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆