prevent uninstalling services

Posted on 2010-01-07
Last Modified: 2013-12-17
i have 2 services which constantly monitoring one another. if user wants to stop any one of them another service starts that once in no time. so user can not stop that services. but if user give "sc" command from dos window, he can uninstall those services. all of my users are administrator in there own pc. they are using xp sp3.

now my question is, can i apply any trick so that user can not uninstall those services from their pcs?

my services are developed in 2005.

Question by:Amitava_Mukherjee
    LVL 3

    Assisted Solution

    Yes you can, but not really in the way you are thinking.

    What you need to do is run 3 services that each other.
    I say 3 services because the user can stop/ unload the services still, but you are counting on the fact that they cant kill all 3 at once.

    In saying that, we did implement something simular a few years ago and found that if someone wanted to do a little bat file or 2 then they could kill an almost unlimited number of services. It all comes down to speed: can your application spawn new services before they are killed?.

    Otherwise there is no way that I am aware of that can stop the user uninstalling services. Even applications like Norton can be stopped if you have the mind to.

    Hope it helps

    Author Comment

    but i am not still clear how to prevent uninstallation of a service

    Author Comment

    can i prevent uninstalling forcing user to give password to uninstall?

    Author Comment


    your comments seems to be interesting. can you clarify a little more?
    LVL 39

    Accepted Solution

    Personally, I find the combination of having people logged in as Administrator and then telling them "you have no right to uninstall" violation of the principle of what an Administrator is. The simplest thing to do is to do it with rights management, but I'm no expert in that field, but you can ask it in the Windows zone. Perhaps: install the services with a domain account, local Admin has no rights over domain accounts.

    Another opinion (I know you didn't ask for this): if a process is unstoppable, I consider it a buggy program and I will take that extra length to uninstall it. And whatever you do, that will always be possible (even viruses can be removed, and this is viral behavior).

    But to the point: services are installed in a key called (top of my head) HKLM/SYSTEM/CurrentControlSet/Services. Monitor the key(s) that hold your services. If they change or get deleted, add them again (i.e.: if they're uninstalled, immediately reinstall them). Simple enough to do and a real pain for anybody trying to uninstall. Also: do the same with the executable and the PendingMoves key in the registry and you've made it pretty airtight.

    Really preventing people taking control of their own machine is simply impossible (or we'd be flooded with malware that we cannot remove). But you can make it quite hard.
    LVL 14

    Expert Comment

    I agree with able.

    There is no way to GUARANTEE that the service will not be uninstalled.  Take Safe Mode, for instance.  If a user is determined enough, your hosed, period.

    But monitoring able's suggestions will go a long way to making it VERY difficult.


    Author Closing Comment

    Thanx, abel, it works. nice solution

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now