views:

4340

answers:

3

using sc command we can query, start , stop windows serice for ex: sc query "windows service name"

sc config command changes the configuration of the service.

but i dont know how to use it.

could someone can tell me how we can set the username and password for windows service.

+2  A: 

It appears you do it like this:

sc config servicename obj=.\username password=password

I haven't tried this so cannot vouch for its correctness.

Andrew Ferrier
+1  A: 

Andrew , it worked with minor changes.

obj= "domain\username"

obj= "LocalSystem"

we have to have space inbetween obj= and username.

userid's are validated that is good.

we have to have blank space in between password= and actual password.

password are not validated, that is bit of pain.

to set back the service again to LocalSystem, which do have passsword, we have give some dummy password to make it work.

like sc config "servicename" obj= "LocalSystem" password= "notused"

sundar venugopal
A: 

in sc command i can control remote systems as well.

sc \remotepc start "servicename" , is there any way to give userid and password along this. which will have access to remote pc.

sundar venugopal