How do I run a xp_cmdshell batch file as a different user?
I have a stored procedure that runa a batch file. The batchfile uses GPG to decrypt a file. When run the batch file from Explorer everything works. The keys for the decryption are installed under another user account that requires a password. However when I execute the stored procedure the batch file does not work. I am assuming that SQL SERVER executes the stored procedure as a sysadmin account therefore not allowing the batch file to execute properly. How can I accomplish getting this to work.
SET @cmdSql = ' EXEC xp_cmdshell C:\Batch\Decrypt_EmailCleansingList.bat'
EXEC sp_executesql @cmdSql
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.