Reputation: 14830
If you want UAC elevated applications to run on windows startup, you need a service. But service applications have a lack of specific features such as creating MessageBoxes or executing other files. The question is: How do I create a startup application with UAC elevation AND the ability to use a GUI and Process.Start() ?
Upvotes: 2
Views: 790
Reputation: 1027
You can use Task Scheduler, and when setting up new task, on General Tab you can select user, including administrator, as well "run with highest privileges". On Trigger tab select "On Startup".
Upvotes: 1
Reputation: 6926
I've had this problem too. As IDWMaster mentioned, the solution is to use the Windows Task Scheduler. Don't think that this is a cheap option - I'd argue that it's better than a service. Quite a lot of softwares do use the Windows Task Scheduler to run administrative tasks. Why? Services, as you well know, aren't able to interact with the desktop so well - if you created a global keyboard hook in a service, for example, it won't capture keys. Why not normal registry startup keys? Because, as you also well know, programs requiring administrative privileges cannot autostart as an administrator using the registry startup keys. Using the Windows Task Scheduler solves all these problems.
Here's an excellent library that makes it an joy to interface with the Windows Task Scheduler in C#: http://taskscheduler.codeplex.com/
Upvotes: 2
Reputation: 108957
You can use NSSM to create a stub service to launch any application.
Upvotes: 1
Reputation: 5529
Use Task Scheduler to schedule your task to run when a user logs in interactively.
Upvotes: 0