When I execute the following statement in SQL Server 2008:
declare @s varchar(100)
set @s='dir'
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'xp_cmdshell',1
reconfigure
exec xp_cmdshell @s
It gives the following error:
execute
xp_cmdshell
error.invoke 'CreateProcess' failed,error code: '5'.
How can I fix this? I enabled the xp_cmdshell
procedure, and I have given the folder read-write privileges.
I searched on the internet and tips to add domain user to the Administrator Group. But I still do not understand the principle. I would appreciate any insights. Thanks!
Error code 5 means - access denied.
Please check if account which used for MSSQL service has right on command that you trying to run.