473,783 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows service Rights question

In writing a Windows service with .NET, I'm noticing that the process for
some services can not be killed with specifically stopping the service. If
you try to kill the process with, say task manager, you get an access denied
message. I just wrote a test service and I can kill the process for this
service without actually stopping the service. Can someone tell me how to
keep the process for my service from being killed without actually stopping
the service?

I appreciate any insight into this thread.

Thanks
Steve
Nov 16 '05 #1
7 3863
Steve,

I read through this several times, but I'm still not confident that I
understand what you mean. A user with administrative privledges on a
box will always be able to stop a service via the service control
manager or kill any process associated with a service on that box.
Though killing a process associated with service running under a
different login will require functionality that the task manager does
not provide, it is always possible. Normal users are unable stop a
service or kill a process associated with a service. If the process
associated with a service does not terminate after stopping the service
in the service control manager then there is a problem with your code.

Brian

Steve Long wrote:
In writing a Windows service with .NET, I'm noticing that the process for some services can not be killed with specifically stopping the service. If you try to kill the process with, say task manager, you get an access denied message. I just wrote a test service and I can kill the process for this service without actually stopping the service. Can someone tell me how to keep the process for my service from being killed without actually stopping the service?

I appreciate any insight into this thread.

Thanks
Steve


Nov 16 '05 #2
Okay, there are processes running on my machine that just happen to also be
Windows services. I didn't write these services. If I open task manager and
try to kill the process, it won't kill it. However, if I go to the Services
Control Panel and stop the service, it kills the process. An example of this
is the McShield.exe service which is the virus checker running on my box. I
can't kill this process but I can stop the service, which kills the process.
I do have admin right on my box they say.

Steve

"Brian Gideon" <br*********@gm ail.com> wrote in message
news:10******** **************@ k17g2000odb.goo glegroups.com.. .
Steve,

I read through this several times, but I'm still not confident that I
understand what you mean. A user with administrative privledges on a
box will always be able to stop a service via the service control
manager or kill any process associated with a service on that box.
Though killing a process associated with service running under a
different login will require functionality that the task manager does
not provide, it is always possible. Normal users are unable stop a
service or kill a process associated with a service. If the process
associated with a service does not terminate after stopping the service
in the service control manager then there is a problem with your code.

Brian

Steve Long wrote:
In writing a Windows service with .NET, I'm noticing that the process

for
some services can not be killed with specifically stopping the

service. If
you try to kill the process with, say task manager, you get an access

denied
message. I just wrote a test service and I can kill the process for

this
service without actually stopping the service. Can someone tell me

how to
keep the process for my service from being killed without actually

stopping
the service?

I appreciate any insight into this thread.

Thanks
Steve

Nov 16 '05 #3
Steve,

I understand what are saying now. This is correct. Although you have
administrative priviledges on your box you will not be able to kill a
process running under the system account from the task manager. You
need to use kill.exe which comes with the resource kit or pskill.exe
which is free and can be downloaded from http://www.sysinternals.com.
I hope this helps.

Brian
Steve Long wrote:
Okay, there are processes running on my machine that just happen to also be Windows services. I didn't write these services. If I open task manager and try to kill the process, it won't kill it. However, if I go to the Services Control Panel and stop the service, it kills the process. An example of this is the McShield.exe service which is the virus checker running on my box. I can't kill this process but I can stop the service, which kills the process. I do have admin right on my box they say.

Steve


Nov 16 '05 #4
Actually, I was wondering how to make my program behave like that too. Can
you help with that?

Steve

"Brian Gideon" <br*********@gm ail.com> wrote in message
news:10******** **************@ k26g2000oda.goo glegroups.com.. .
Steve,

I understand what are saying now. This is correct. Although you have
administrative priviledges on your box you will not be able to kill a
process running under the system account from the task manager. You
need to use kill.exe which comes with the resource kit or pskill.exe
which is free and can be downloaded from http://www.sysinternals.com.
I hope this helps.

Brian
Steve Long wrote:
Okay, there are processes running on my machine that just happen to

also be
Windows services. I didn't write these services. If I open task

manager and
try to kill the process, it won't kill it. However, if I go to the

Services
Control Panel and stop the service, it kills the process. An example

of this
is the McShield.exe service which is the virus checker running on my

box. I
can't kill this process but I can stop the service, which kills the

process.
I do have admin right on my box they say.

Steve

Nov 16 '05 #5
As far as I know your program should behave exactly the same way as
long as it is running under the system account. Are you saying that it
doesn't?

Steve Long wrote:
Actually, I was wondering how to make my program behave like that too. Can you help with that?

Steve

"Brian Gideon" <br*********@gm ail.com> wrote in message
news:10******** **************@ k26g2000oda.goo glegroups.com.. .
Steve,

I understand what are saying now. This is correct. Although you have administrative priviledges on your box you will not be able to kill a process running under the system account from the task manager. You need to use kill.exe which comes with the resource kit or pskill.exe which is free and can be downloaded from http://www.sysinternals.com. I hope this helps.

Brian


Nov 16 '05 #6
Yes, I think that's what I'm saying. It fails to install unless I set the
Account property to User in the serviceProcessI nstaller object.

Steve

"Brian Gideon" <br*********@gm ail.com> wrote in message
news:10******** **************@ k26g2000oda.goo glegroups.com.. .
As far as I know your program should behave exactly the same way as
long as it is running under the system account. Are you saying that it
doesn't?

Steve Long wrote:
Actually, I was wondering how to make my program behave like that

too. Can
you help with that?

Steve

"Brian Gideon" <br*********@gm ail.com> wrote in message
news:10******** **************@ k26g2000oda.goo glegroups.com.. .
Steve,

I understand what are saying now. This is correct. Although you have administrative priviledges on your box you will not be able to kill a process running under the system account from the task manager. You need to use kill.exe which comes with the resource kit or pskill.exe which is free and can be downloaded from http://www.sysinternals.com. I hope this helps.

Brian

Nov 16 '05 #7
I have no idea why it won't install when set to LocalSystem. I've
never had that problem before.

Brian

Steve Long wrote:
Yes, I think that's what I'm saying. It fails to install unless I set the Account property to User in the serviceProcessI nstaller object.

Steve


Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7192
by: Eric Chong | last post by:
I created a Windows Service in C# that requires to get passed command arguments like a Console App. I noticed that there is an option "Start parameters" text box in the property of a Windows Service in MMC. Is there any way to get arguments using this option? If possible, what framework method should I use to get an arguement? Thanks in advance. Eric
8
4192
by: Bill Sonia | last post by:
I've written a Windows Service to send e-mails on events like OnStart, OnStop, OnShutDown using System.Web.Mail. It works for everything but OnShutdown. My guess is that for OnShutDown, once my send mail code is executed, other necessary Windows Services have been terminated before it can actually send the mail. I've updated my HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services registry DependOnService value including SMPTSVC and...
4
2424
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). The problem is that the user who "owns" the service is always the ASPNET account. That's not good since you don't see the actual application (because it's owned by ASPNET). I've tried changed the processmodel section in the machine.config file to...
5
2698
by: pberna | last post by:
Dear all, I built a Web Form application to start and stop a Windows Service remotely. I successful tested the application on Windows 2000 server + IIS. I must include the ASPNET user to the Administration group (on server side) to have the necessary authorization to start a Windows Service (I don't understand why "Power User" rights are not enough to do the same thing) Although I'm able to start a service using windows 2000 server...
10
3490
by: Ger | last post by:
I am having problems using VB.Net's Management base object on a machine hosting Windows Server 2003. I am trying to set file permissions from a Windows Service. These files may be loacted on a local machine or somewhere on the network. I use the Management Base Object to set these permissions which works perfectly when the windows service is running on an XP machine. However, when the service is running on a Windows Server 2003 machine I...
3
3691
by: Doug Bailey | last post by:
I am trying to control a Windows Service via a Web Service interface. (I am developing in .NET2003) I am using the ServiceController object which allows me to read the state of the services with no problems. However, I am not able to start or stop the service unless I go through the process of impersonating an administrative user. (See MSDN KB 306158) Since it appears to be a privilege issue, I set the folders in IIS holding the Web...
3
14951
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim swLog As StreamWriter = File.CreateText("C:\myLog.txt") swLog.WriteLine("My Windows Service has just started.") swLog.Close() : swLog.Flush() End Sub
3
2618
by: Chris Dunaway | last post by:
I am writing a Windows Service that reads and processes files on a set schedule. I want to create a second app that can monitor the Windows service. The Windows service will write trace messages at certain points while executing. The monitoring app I want to write will be very simple, just picking up these traces and displaying them to show progress of the service. My question is what is the best method of communication between the...
5
3308
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.