xp_cmdshell whoami – Determine which Windows Account is used

03 October,2014 by Jack Vamvas

Question: I’m experiencing an execute error when running a script through xp_cmdshell? I think the issue is related to my Windows permissions on the OS. How can I view the Windows account used when I execute xp_cmdshell?

Answer: This is a common problem. When executing xp_cmdshell through SQL Server – the security context is the SQL Server start up account.

Use  the command "xp_cmdsell whoami" to view the account used.

Note: Treat xp_cmdshell with caution . Read Xp_cmdshell – the most dangerous extended stored procedure on the planet

Related Posts on who is using SQL Server

SQL Server – Restrict SQL Server Logons by IP with EVENTDATA and SQL Logon Trigger

How to create a SQL Server Security Audit

 


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on xp_cmdshell whoami – Determine which Windows Account is used


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer