SC comand fails with "[SC] OpenService FAILED 5:"


good morning.

i have legacy deployment script uses sc command stop service, make changes , start service.

it's simple:

sc <server-name> stop  <service-name>
sc <server-name> query  <service-name>

...do stuff...
sc <server-name> start <service-name>
sc <server-name> query  <service-name>

this deployment script has worked years on 2008r2 server. switching 2012r2 server. our provider has given new servers , building out.

on some of servers script works fine. on other servers fails.

after digging script found failing on sc start , sc stop commands (an example of failure below


c:\>sc <server> stop  <service>
[sc] openservice failed 5:

access denied.


c:\>echo %errorlevel%
5

c:\>


the way execute scripts simple double click windows explorer. script runs under permissions of logged in user.

i know can open command prompt administrator , execute script , works fine. however, workaround isn't acceptable. need figure out configuration value or setting on of these servers causing failure.

as indicated earlier, on of our machines works fine running user , on other machines fails. sort of permissions should checking this? provider doesn't seem know, machines deployed same -- , yet different behavior on 2 machines.

i'm suspecting there sort of user permission difference (which not managed provider, different group). need more information share them, or better yet, able @ server , see permission setting, , server b , see missing setting , share them.

thanks in advance!

john


if users not administrators follow along here.

http://social.technet.microsoft.com/wiki/contents/articles/5752.how-to-grant-users-rights-to-manage-services-start-stop-etc.aspx

 

 

 



regards, dave patrick ....
microsoft certified professional
microsoft mvp [windows server] datacenter management

disclaimer: posting provided "as is" no warranties or guarantees, , confers no rights.



Windows Server  >  Windows Server 2012 General



Comments

Popular posts from this blog

Group Policy Event ID 1058 Error Code 1326 (The user name or password is incorrect)

Suspicious event log Event ID: 4905

DCOM received error "2147746132" from...