Windows – Access denied if I try to control Windows 2016 service remotely

windowswindows-server-2016windows-service

I have following script:

cmdkey.exe /add:COMPUTER /user:COMPUTER\user /pass:somepassword
sc \\COMPUTER stop Servicename

Works fine with Windows 2012 R2 but not with Windows 2016. With windows 2016 I get this error: [SC] OpenService FAILED 5: Access is denied.

User is admin. If I log to COMPUTER with User and run this command – it works.
If I run this command remotely from some domain account – it works.

Same problem with alternative command:

psservice \\COMPUTER -accepteula stop Servicename

Best Answer

assuming the admin account is a local account you are probably encountering remote UAC.