以最高权限运行计划任务
我目前正在编写一个自动更新 ccleaner 的应用程序。一切正常,直到我启用 UAC ..我正在使用这个项目: http://www .codeproject.com/KB/cs/tsnewlib.aspx 安排更新过程,但是当启用 uac 时,我每次都会收到一条消息,询问是否允许 ccleaner 安装程序对我的计算机进行更改。自动更新过程必须以静默方式完成,不得通过 uac 提示来打扰用户。
当我手动选中任务计划程序中的“以最高权限运行”框时,它确实会在没有提示的情况下运行。但我似乎无法以编程方式执行此操作。或者我还没有找到它。
PS抱歉英语不好
Im am currently coding an application for auto updating ccleaner. Everything worked well until I enabled UAC.. I am using this project: http://www.codeproject.com/KB/cs/tsnewlib.aspx
to schedule the updating process, but when uac is enabled I get every time a message if I would let ccleaner installer make changes to my computer. The auto updating process must be done silently without bugging the user with prompts of uac.
When i manually check the "run with highest priviliges" box in task scheduler it does run without a prompt. But I can't seem to do this programmatically. Or I havent found it yet.
P.s. Sorry for the bad english
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
啊找到了!
http://taskscheduler.codeplex.com/wikipage?title=Examples& referingTitle=Home#simple
该包装器的“运行级别”帮助了我!
我必须重新编码一些代码,但这是值得的
ah found it!
http://taskscheduler.codeplex.com/wikipage?title=Examples&referringTitle=Home#simple
The "runlevel" of that wrapper helped me out!
I must recode some code but it is worth it
一种不太引人注目的方法,不调用安全标识符:
将此行更改为您的程序名称,如下所示:
immortal.RegistrationInfo.Description = "运行你的程序"
A less dramatic approach, that doesn't call on security identifiers:
Change this line to your programs name seen below:
immortal.RegistrationInfo.Description = "Run YourProgram"
完成您所要求的操作的最有效方法(假设我正确理解您)是使用我为您拼凑在一起的 GPO。登录时将其设置为RunOnce。如果您希望每次都发生这种情况,请将 Rythorians_SubContractors() 下的 RunOnce 更改为 Run。为了解释这一切,我在代码中留下了注释。这是实现你想要的事情的一个严肃的方法。作为一名 IT 人员,我使用此代码推送到一个已被恶意软件过度运行的系统,以授予我的程序访问该用户系统的权限,以便修复它。我也会为您留下一个不太强大的方法供您选择。
您必须在 Rythorians_SubContractors() 下的代码中调整以下内容:
($"/C schtasks /create /rl HIGHEST /sc ONLOGON /tn Scarlett Centurium /F /tr)。
名称必须从 Scarlett Centurium 更改为您的程序名称,并且位于 SetValue 下的名称下方:(您的程序名称)
My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\RunOnce", True).SetValue("Scarlett Centurium", Process.GetCurrentProcess.MainModule.FileName)
我通常会尝试避免在 stackoverflow 上发布任何内容,因为总会有人对此有一些巧妙的说法,尽管他们永远无法提供更好的答案。 我欢迎任何人接受挑战,只要你能提供更好的东西。如果不是,你应该保留一些尊严并保持沉默。
The most efficient way to do what you are asking, (granted I am understanding you correctly) is to use this GPO I slapped together for you. It is set to RunOnce at login. If you wish for this to happen every time, change the RunOnce to Run under Rythorians_SubContractors(). To explain all this, I left notes in the code. This is a serious means of accomplishing what you want. As an IT, I used this code to push into a system that had been over run with malware to grant my program access to that users system in order to fix it. I will leave a less powerful means optional for you as well.
Here is something you will have to adjust in the code under Rythorians_SubContractors():
($"/C schtasks /create /rl HIGHEST /sc ONLOGON /tn Scarlett Centurium /F /tr).
The name will have to be changed from Scarlett Centurium to whatever your programs name is and just below that under the SetValue: (Your Programs Name)
My.Computer.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\RunOnce", True).SetValue("Scarlett Centurium", Process.GetCurrentProcess.MainModule.FileName)
I generally try to avoid posting anything on stackoverflow because somebody always has something slick to say about it, although they can never provide a better answer. I welcome anyone to the challenge, granted you can provide something better. If not, you should save yourself some dignity and stay silent.