Quantcast
Channel: SQL Archives - SQL Authority with Pinal Dave
Viewing all articles
Browse latest Browse all 594

SQL SERVER – Msg 15137, Level 16 – Error Related to sp_xp_cmdshell_proxy_account

$
0
0

So far, I have written many blogs and I still feel that there are many errors and scenarios which are still uncovered. Whenever I see a new error and find a new solution, I always share it via this blog.  Let us see how we can fix errors related to sp_xp_cmdshell_proxy_account.

One of my clients was using below blogs to use proxy to run xp_cmdshell.

SQL SERVER – Fix: The EXECUTE Permission was Denied on the Object ‘xp_cmdshell’, Database ‘mssqlsystemresource’,schema ‘sys’.

SQL SERVER – Enable xp_cmdshell using sp_configure

They informed that they are getting errors while using sp_xp_cmdshell_proxy_account. Here is the first error:

Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1 [Batch Start Line 5] An error occurred during the execution of sp_xp_cmdshell_proxy_account. Possible reasons: the provided account was invalid or the ‘##xp_cmdshell_proxy_account##’ credential could not be created. Error code: 1326(The user name or password is incorrect.), Error Status: 0.

I was able to reproduce the error by running below (i.e. by giving wrong password)

EXEC sp_xp_cmdshell_proxy_account 'domain\user', 'WrongPassword'

Now, I have given the right password as below

EXEC sp_xp_cmdshell_proxy_account 'domain\user', 'RightPassword'

But got below error.

Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1 [Batch Start Line 6] An error occurred during the execution of sp_xp_cmdshell_proxy_account. Possible reasons: the provided account was invalid or the ‘##xp_cmdshell_proxy_account##’ credential could not be created. Error code: 5(Access is denied.), Error Status: 0.

WORKAROUND/SOLUTION

In both errors above, even though error message is the same, the Error Code is different. First one has 1326 which was due to incorrect password. The second one has error code of 5, which means access denied. To fix this error, I should launch SSMS as Run as Administrator as shown below.

SQL SERVER - Msg 15137, Level 16 - Error Related to sp_xp_cmdshell_proxy_account xp_cmd-proxy-01

The above image is taken from the Windows 2016 Operating system, start menu. You might have a different interface, but you get an idea.

Let me know what you think of this blog post by leaving comments below.

Reference: Pinal Dave (https://blog.sqlauthority.com)

First appeared on SQL SERVER – Msg 15137, Level 16 – Error Related to sp_xp_cmdshell_proxy_account


Viewing all articles
Browse latest Browse all 594

Trending Articles