1
From SQL server 2012 I try to do this:
DECLARE @COMMAND nvarchar(4000)
SET @COMMAND = 'net stop <servicename>'
exec master.dbo.xp_cmdshell @COMMAND
I get system error 5 and Access denied as response
The service account (checked with whoami
) is added to the administrators, so what else can be wrong?
when you way 'From SQLServer 2012', do you mean from SQLServer Management Studio (ssms.exe) ? – Frank Thomas – 2017-08-11T15:31:09.290
Yes, if I put the command(s) in a .bat or .cmd and run that from the OS it's fine. When I try to run it from ssms I get the same error. – Sjef – 2017-08-14T13:29:51.980
run ssms as admin. – Frank Thomas – 2017-08-14T13:39:57.863