How can this problem be solved?

I know there is a sc utility, but I don't know how to assign the Local Service account to the obj parameter (because of the spaces in the name), and how to assign a blank password (I assume Local Service account has a blank password) to the password parameter.

  • What version of Windows is this?
    – uSlackr
    Jun 8 '11 at 13:06
  • I'm testing this on Win7 but it should apply to XP as well and corresponding server versions
    – alh84001
    Jun 8 '11 at 13:09

This should work: SC CONFIG MyService binPath=c:\myprogram.exe obj=".\LocalSystem" password=""

  • Look at some of the examples here: ss64.com/nt/sc.html
    – Chris N
    Jun 8 '11 at 13:16
  • Thank you. I took that last example, and played with it and finally got it to work with SC.EXE CONFIG MyServiceName obj= "\Local Service" password= ""
    – alh84001
    Jun 8 '11 at 15:09

To be clear, the proper command is:

  • For me (Windows 10) it only worked without the password property
    – Valentin
    Jul 22 at 16:12

Regarding previous comment, be aware that Local System and Local Service is not the same account. Local Service has much less rights.


@Amir's answer was the closest, but spaces are needed after the equal signs. If you view the help for SC.EXE, you'll see:

NOTE: The option name includes the equal sign.
      A space is required between the equal sign and the value.

So to get this to work under the real Local Service account on Windows 2012 R2, the following worked:

SC.EXE CREATE TheServiceName start= auto binPath= "C:\path\to\TheService.exe" obj= "NT AUTHORITY\LocalService" password= ""

When I tried...

obj= "\Local Service"

...it didn't get set to run under the real Local Service account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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