Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bbasir
Yak Posting Veteran
76 Posts |
Posted - 2008-03-26 : 17:08:41
|
I am running an xp command shell command from my sp... I have createda proxy account as the sp is called by a sql server user id.I get the following message.Any ideas?Msg 50001, Level 1, State 50001xp_cmdshell failed to execute because current security context is not sysadmin and proxy acount is not setup correctly. For more information, refer to Book Online, search for topic related to xp_sqlagent_proxy_account. |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-03-26 : 17:11:00
|
What it means is you need to read BOL for proxy account for xp_cmdshell. |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-03-26 : 21:51:42
|
How did you create proxy account? Is proxy account a member of sysadmin? |
 |
|
bbasir
Yak Posting Veteran
76 Posts |
Posted - 2008-03-27 : 16:34:15
|
No the proxy account is not a member of system admin. we donot want it to have sysadmin priviliges... we just want the account to run the xp_cmd_shell job... |
 |
|
bbasir
Yak Posting Veteran
76 Posts |
Posted - 2008-03-27 : 16:38:28
|
I Used the following code from microsoft to set the proxy account...............--first step-- Set database to master.USE masterGO-- Add a valid Windows account as proxy account.EXECUTE xp_sqlagent_proxy_account N'SET' , N'<DomainName>' , N'<WindowsAccount>' , N'<WindowsPassword>'GO-- Get the proxy account to determine whether it is set up correctly. EXECUTE xp_sqlagent_proxy_account N'GET'GO-- Enable non-system administrators to run the job and to execute xp_cmdshell.EXECUTE msdb..sp_set_sqlagent_properties @sysadmin_only = 0GO--2nd step...USE masterGO-- Grant database access to the SQL Server login account that you want to provide access.EXEC sp_grantdbaccess '<SQLLogin>'GO-- Grant execute permission on xp_cmdshell to the SQL Server login account.GRANT exec ON xp_cmdshell TO <SQLLogin>GO |
 |
|
bbasir
Yak Posting Veteran
76 Posts |
Posted - 2008-03-27 : 18:50:02
|
This issue was resolved..... I had not set up this step properly... -- Add a valid Windows account as proxy account.EXECUTE xp_sqlagent_proxy_account N'SET', N'<DomainName>', N'<WindowsAccount>', N'<WindowsPassword>'GO |
 |
|
|
|
|