In SQL Server 2012, to allow a non-sysadmin login to execute xp_cmdshell, must the user account be a Windows Domain account? In other words can a SQL Server account be used?
I found these instructions for SQL Server 2005 and 2008. Can they be used for SQL Server 2012? Is PowerDomain\PowerUser an Active Domain account?
USE master
GO
-- Create a test login called XPCmdshellUser
CREATE LOGIN XPCmdshellUser WITH PASSWORD='P3h4jek@x'
-- Create a proxy credential for xp_cmdshell.
EXEC sp_xp_cmdshell_proxy_account 'PowerDomain\PowerUser',
'P@ssw0rd';
-- Grant database access to the SQL Server login account that you want to provide access.
EXEC sp_grantdbaccess 'XPCmdshellUser'
-- Grant execute permission on xp_cmdshell to the SQL Server login account.
GRANT exec ON sys.xp_cmdshell TO [XPCmdshellUser]
GO
lcerni