5

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.

alh84001
  • 153
  • 1
  • 1
  • 3

4 Answers4

6

To be clear, the proper command is:

SC CONFIG MYSERVICENAMEHERE obj="NT AUTHORITY\LocalService" password= ""
3

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

DavisNT
  • 326
  • 1
  • 3
  • 12
3

@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.

D Rickard
  • 31
  • 1
-2

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

Chris N
  • 687
  • 3
  • 8
  • Look at some of the examples here: http://ss64.com/nt/sc.html – Chris N Jun 08 '11 at 13:16
  • 1
    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 08 '11 at 15:09