Hosea146
Hosea146

Reputation: 7712

Unable to Delete or Create a Windows Service from the DOS Command Line

I am attempting to delete a C# based Windows Service from the DOS command line as follows:

sc Delete "MyService".

I am getting an error which says:

"[SC] OpenSCManager FAILED: 5"

"Access is Denied"

This is my own personal computer I'm attempting this on. Can anyone tell me exactly what I'm being denied from, and how to get around this?

Upvotes: 1

Views: 9309

Answers (1)

Oded
Oded

Reputation: 499152

You need to run this from an elevated command prompt (i.e. Run as Administrator), in order to ensure the correct permissions.

See how to do this in the answer to "How do I run a command with elevated privileges?" on the official Command Prompt: frequently asked questions page.

Upvotes: 9

Related Questions