windows service Logon credentials change

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

we have four app servers and 5 services are installed in each machine.
For every 60 days we need to change winodws domain users passwords, which
the services run.

Is there any way we can grab the service programatically and change service
logon credentials using C# utility?
I can loop through all services installed on the machine using the following
code.

foreach(ServiceController sc1 in ServiceController.GetServices())
{
MessageBox.Show(sc1.DisplayName.ToString());


}

But I don't know how to change service logon credentials.
Do you guys have any idea?
Thanks
Anil
 
Anil said:
Hi All,

we have four app servers and 5 services are installed in each machine.
For every 60 days we need to change winodws domain users passwords, which
the services run.

Is there any way we can grab the service programatically and change
service
logon credentials using C# utility?
I can loop through all services installed on the machine using the
following
code.

foreach(ServiceController sc1 in ServiceController.GetServices())
{
MessageBox.Show(sc1.DisplayName.ToString());


}

But I don't know how to change service logon credentials.
Do you guys have any idea?
Thanks
Anil

Why not simply use the command line utility 'sc.exe' provided by the system
for this?

This command:
sc \\serverX config SomeService password= xxxx

changes the password of the service SomeService on serverX

Willy.
 
Back
Top