472,950 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,950 software developers and data experts.

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 3822
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*********@gmail.com> wrote in message
news:10**********************@k17g2000odb.googlegr oups.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*********@gmail.com> wrote in message
news:10**********************@k26g2000oda.googlegr oups.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*********@gmail.com> wrote in message
news:10**********************@k26g2000oda.googlegr oups.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 serviceProcessInstaller object.

Steve

"Brian Gideon" <br*********@gmail.com> wrote in message
news:10**********************@k26g2000oda.googlegr oups.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*********@gmail.com> wrote in message
news:10**********************@k26g2000oda.googlegr oups.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 serviceProcessInstaller object.

Steve


Nov 16 '05 #8

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

Similar topics

5
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...
8
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...
4
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). ...
5
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...
10
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...
3
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...
3
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...
3
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...
5
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?...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

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.