Logon failure: unknown user name or bad password.

I am trying to create new dir from one server to the another using SQL

 EXEC master..xp_cmdshell 'MKDIR \\ServerName\Test'

This work with all mt SQL server except for one.

Error: Logon failure: unknown user name or bad password.

Can anyone please help me!!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Make sure \\Servername exists and Make sure SQL service account has the access to create folder on the server.
AnvieAuthor Commented:
I am sure Servername exist and regarding on access. it should say access denied instead right?

I can create new folder from server to another server using cmd.exe but not SQL.

I have a question. how will I know what credential my SQL uses to access the folder from another server?

Yes, you are right about the error but sometimes you may different error based on the way you are executing....
When you can create using cmd that means you have the access to the othere server because you logged into the souce server as you...
To test it try logged into the source server as SQL service accoutn and try or
Run the following in QA and see wha you get...
exec xp_cmdshell 'Dir \\servername\c$'
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

AnvieAuthor Commented:

I tried this: exec xp_cmdshell 'Dir \\servername\c$'
 And get the same error.  Logon failure: unknown user name or bad password.
Anthony PerkinsCommented:
The problem is that the SQL Server service account does not have the correct permissions to "ServerName".
AnvieAuthor Commented:
hmmm how can I check if my SQL have correct permission?

I read you link MohammedU but it doesn't work...

AnvieAuthor Commented:
My server1 to 10 can access each even server11 but server11 can only access itself.

This works fin with all my server

EXEC master..xp_cmdshell '\\Server10\FolderName'

Except in Server11

please help!
AnvieAuthor Commented:
Hi can anyone please help me....

when I run this query:
User Server01
EXEC master..xp_cmdshell 'MKDIR \\Server02\FolderName'

it retuned me this error:
Logon failure: unknown user name or bad password.

if I run this command in command prompt in server01
MKDIR \\Server02\FolderName

It works fine...

Just in SQL returned error...

but if I use this instead:
Use Server02
EXEC master..xp_cmdshell 'MKDIR \\Server01\FolderName'

it also works fine.

It just server01 can't access any of my server using SQL but any of my server can access server01

Please help me. I been dealing with this for a week now.

Anthony PerkinsCommented:
>>how can I check if my SQL have correct permission?<<
You need to find the account used by the SQL Server service account.  This is the account that does not ahve the necessary permissions to access Server11

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.