use master
GO

GRANT EXECUTE ON xp_cmdshell TO sql_user
EXEC sp_xp_cmdshell_proxy_account 'domain\Administrator','pass'
GO

EXECUTE AS login = 'sql_user'
--Below fails, no execute permission on xp_cmdshell
EXEC xp_cmdshell 'DIR C:\*.*'
revert -- return control to the original user

Comments are closed.