Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a WCF Service being hosted by a Windows Service.

How would I go about starting the service from the command line while passing the following arguments

The user I would like the service to logon as. I also need to pass in the password for the user.

I have previously been entering the values into services.msc but I find this tiresome

share|improve this question
up vote 6 down vote accepted

On which Windows release?

On recent ones, sc.exe is your friend here.

sc start ServiceName
sc stop ServiceName

sc config ServiceName option= value

The last one lets you set many things, amongst them the startup type and the service's logon user account (and password).

sc is odd in that, when using the config argument a space must follow each argument's equals sign.

share|improve this answer
You're the man. That is it. – bearrito Jul 28 '10 at 20:24
Thanks Evan, I totally forgot about the "space" thing. – Massimo Jul 29 '10 at 5:35

Additionally, if you are always working locally (i.e. not remoting controlling services on other machines) you can use

net start "service name"
net stop "service name"

To expand on Massimo's answer, you can use service control (sc) to minipulate services on other machines in your domain:

sc \\serverName start "service name"
sc \\serverName stop "service name"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.