0

I am running the command:

sc \\My-Server create TestService binPath= "C:\Test\Test.exe"

However, it fails with

[SC] OpenSCManager FAILED 5:

Access is denied.

My hosts file contains:

127.0.0.1 My-Server

However, if I do the command below, it works just fine!

sc \\127.0.0.1 create TestService binPath= "C:\Test\Test.exe"
[SC] CreateService SUCCESS

I am running cmd as admin. Any ideas?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Eza
  • 43
  • 6

1 Answers1

0

Resolved. I found this thread: https://serverfault.com/questions/184098/why-cant-i-access-an-administrative-share-on-my-local-machine

Step 2: "Allowing server machine to use filesharing with itself via the DNS Alias (BackConnectionHostNames)" is what fixed it for me. I added a multi-string value called BackConnectionHostNames in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0 and gave it a value of My-Server. Ran the sc command again, and it worked.

Eza
  • 43
  • 6