Posted on Leave a comment

A call to ‘LogonUserW’ failed with error code: ‘1385’

Msg 15121, Level 16, State 200, Procedure xp_cmdshell, Line 1
An error occurred during the execution of xp_cmdshell. A call to ‘LogonUserW’ failed with error code: ‘1385’.

1385 = Logon failure: the user has not been granted the requested logon type at this computer.

Solution:

  1. Look up the Windows user that is assigned to credential [##xp_cmdshell_proxy_account##]
  2. Run secpol.msc
  3. Navigate to “Local Policies” -> “User Rights Assignment” -> “Log on as a batch job”
  4. Add the user found from step 1 to “Log on as a batch job”
  5. Test by executing sql stored procedure: “EXEC master..xp_cmdshell ‘whoami'”

 

Troubleshooting xp_cmdshell failures

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.