Monday 19 July 2010

xp_cmdshell raises error "a call to LogonUserW failed with error code 1385"

xp_cmdshell requires a couple of permissions to enable non-sysadmin users to run it, and even when you think you have enabled it in surface area config, and assigned an account to the ##xp_cmdshell_proxy_account##, you will frequently find you still encounter the following error:

An error occurred during the execution of xp_cmdshell. A call to 'LogonUserW' failed with error code: '1385'.

In order to fix this you need to open the Local Security Settings on the host machine.
 
Navigate to Security Settings -> Local Policies -> User Rights Assignment.
 
Now open "Log on as a batch job" and add the user you assigned to the xp_cmdshell proxy account - and you should find it runs fine now.

28 comments:

Boon said...

This Solution worked for me..
Thanks a lot for your help.

Kyle said...

awesome ... thanks grumpy :)

Brian said...

Worked for me too!
Thx :)

Deependra said...

Thanks a lot for the help. It worked.

Anonymous said...

Thanks a lot . It worked for me as well

Anonymous said...

Great.Thanks a lot.Worked for me too.

Anonymous said...

Thanks a lot Grumpy. It worked for me too! - signed Happy!

Grumpy DBA said...

Good to see this one is still useful - I'm almost not Grumpy about that!

Anonymous said...

Useful it is indeed, and high in Google rankings. Thanks for putting it up!

Anonymous said...

Wow !!! It worked !! After searching for days... I finally made it ! Thanx a lot ! :)

Anonymous said...

Gracias, seƱor, for the useful info.

Anonymous said...

Also make sure that the account password is set to never expire in windows user manager

Rembrandt said...

great info. why isnt this referred by MS on setup

Anonymous said...

Amazing, thank you!

mina smith said...

Love you!! Fixed this problem perfectly.

Corey Mingo said...

Nice. This solved my problem.

Anonymous said...

I have been searching for two days! Thank you so much!

Anonymous said...

Worked a treat - thanks for posting that!

Anonymous said...

Wonderful, thank you so much

Anonymous said...

Thanks. Got me out of a jam.

Anonymous said...

Thank you for taking the time to write. This worked for me.

Anonymous said...

Perfect fix. So helpful!

Anonymous said...

Thanks GDBA! This worked like a charm.

Anonymous said...

This has helped me as well. Thanks!

Unknown said...

Works! Thanks

Unknown said...

an error occurred during the execution of xp_cmdshell.a call to 'logonuserW' failed with error code:1326

it is throwing above error even I had granted execute on [domain\user]. Could anyone help me on the same.

Unknown said...

Thank you. Reminded me of the fix just when I needed it

Modding 392 said...
This comment has been removed by the author.

Post a Comment