Yes, but you need to check:
1 2 3 4 5 6 7 8 9 10 |
SELECT CURRENT_USER; xp_cmdshell 'whoami'; EXECUTE AS user = 'domain\user' SELECT CURRENT_USER; xp_cmdshell 'whoami' xp_cmdshell 'dir \\server\sharename' Revert; -- exit from current user SELECT CURRENT_USER; |