Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I want to create a windows service which is unstoppable and unmodifiable in all the accounts except base administrator. The service should be started or stopped only from the base administrator and not from any local administrators. In other local administrators, the service must be running and unstoppable. Which MSDN api must I use to achieve this?
Please help me.

What I have tried:

I tried using functions like AdjustTokenPrivilege function.
Posted
Updated 8-Mar-21 6:25am
v2

1 solution

Read Installing a Service documentation from Microsoft. Must must apply the correct credentials in CreateService.

It is best practice to log all error in the error console or write some log. Test all features on some test target machine and NOT on a developer machine.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900