bytecode77
bytecode77

Reputation: 14830

Service vs. Process

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

Answers (4)

Andrew
Andrew

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

Jason
Jason

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

Bala R
Bala R

Reputation: 108957

You can use NSSM to create a stub service to launch any application.

Upvotes: 1

bbosak
bbosak

Reputation: 5529

Use Task Scheduler to schedule your task to run when a user logs in interactively.

Upvotes: 0

Related Questions