Troubleshooting sp_xp_cmdshell_proxy_account Errors

I was attempting to establish the command shell proxy on my local machine and ran into a series of errors.   As I looked at them more I decided to file some work items with the SQL dev team to provide better context in the message text.   I hope this post will help provide some insight until then.

Focusing on the Error code seems to the be best way to attack the 15137 error.  Shown here is an invalid password condition because I typed in the wrong password on my first attempt.

Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1
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'.

(NT Command: net helpmsg ####) OS Error 1326 = Logon failure: unknown user name or bad password.

I correct the password and I still received the error, this time with an error code of 0.  (What???)  What I would later discover was that UAC plays a role in the creation of the proxy account.

Vista - SP2 (RC) - Returns 0

Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1
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: '0'.

Vista - SP1 - Returns 5

Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1
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'.

Workaround:   Start SQL Server Enterprise Manager (SSMS) as an elevated administrator 'Run As Admin' and sp_xp_cmdshell_proxy_account completes successfully.

Ring Buffers:   If you are using SQL Server 2008 or SQL Server 2005 SP2 or later version the sys.dm_os_ring_buffers DMV entries related to security can also be helpful in determining the root cause of the issue.

Error Code: Remember to focus on the error code, it often tells the real story.

Bob Dorr - Principal SQL Server Escalation Engineer