Run service with administrator privileges

thecaptain0220 picture thecaptain0220 · Apr 6, 2014 · Viewed 25.1k times · Source

I am developing an application that runs as a windows service. I really need the service to have administrator privileges. I tried with the LocalSystem user, and it does not have enough rights. Is this possible? I tried setting requireAdministrator in the app.config. When I do this, the service starts and then immediately stops. I have tried with other administrator accounts as well, but I get the same results.

Answer

gbjbaanb picture gbjbaanb · Apr 6, 2014

You just need to run it as an admin user - set the login correctly in the services properties for the service.

Usually though it's best to run as an ordinary user and give it explicit permissions to the resources it needs access to.