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