changing user in a windows service

  • Thread starter Thread starter Daniele
  • Start date Start date
D

Daniele

Hi,
I have deployed a windows service, that starts with Local System account.
In some particular situations, I need to change the account for the service.
I don't want to tell the user to go on \Control Panel->Administrative
Tools->Services ecc..., but I want to show a dialog where the user can enter
user name and password to configure the service.
Is there a way to pass the account information to the service, when the
service is already deployed?
I looked for in the System.ServiceProcess namespace, but I haven't found it.
Thanks in advance,
Daniele
 
Hi Daniele,

The process that you are trying to do is called Impersonation,
but the problem can be that the service won't start because the user's
rights can't start services.
If that's the problem, then you need an administrator to come in and change
that.

Hope this helps you.

Thaks
Raghavendra
 
Thanks for your help, but the problem I have is still more basic... I don't
know how to set the user in a windows service, after the windows service was
already installed.
For example, there is a service that runs with local system account. From my
configuration application I want to change the account for the service.
Assumes that the user enter the credentials of an administrator user, how
can I pass the credentials to the service? I think I cannot use the
ServiceInstaller object, because the service is already installed, so I have
no idea about what I can use!
 
Back
Top