Unable to start/delete Windows Service created under Local System

325 Views Asked by At

As part of an MSDeploy post step I run

sc create MyService binPath= "C:\Services\MyService"

(Note that this command is run from the remote server)

Trying to start/delete the service using sc or via the UI results in an Access Denied error which doesn't make sense. Why would the local system not be allowed to do that? You can't go to the service folder and add local system as a user..

What am I doing wrong?

If I need to use another account such as Local Service or Network Service how do I specify the account to use in my sc create command?

1

There are 1 best solutions below

0
On

Yikes, I specified the name of the directory rather than including the executable.

Apparently sc will still create the service without error.