Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

map drive in batch file

Posted on 2004-08-24
8
Medium Priority
?
1,548 Views
Last Modified: 2012-06-21
I am trying to map a drive in a batch file.  the command is...

net use y: \\server\share password /user:domain\username

it works when I do it from a command line, but when I put it in a batch file and run that I get...

System error 1326 has occured.
Logon failure: unknown user name or bad password.

I am doing this on a Windows 2003 server trying to connect to another of the same.  Any thoughts?

Thanks,
Tim
0
Comment
Question by:timnorvel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 10

Expert Comment

by:dis1931
ID: 11888930
I believe the problem you are running into is that when you are running this from a batch file as a different user it should prompt for credentials of the username you specify.....if you are doing this when logged in as the username that you are specifying in the net use command then it will not prompt you for credentials as they are already present due to your login...

Dis
0
 
LVL 7

Expert Comment

by:wparrott
ID: 11889067
Unless the username you are logging onto the 1st server with doesn't have permissions to access the shared folder on the 2nd server, you don't have to specify the username/password in the net use command.

Try replacing the password in the batch line with an asterick '*' and log in again. It should prompt you for the password in the command prompt. Does it work this way?
0
 

Expert Comment

by:mzgola
ID: 11889155
net use y: \\server\share password /user:domain\username

try to username@domain.com "use your domain name" or just do it like /user:domain\%username%

0
 

Author Comment

by:timnorvel
ID: 11897334
Thanks for the comments.  I should have mentioned that I am trying to schedule this batch file to run a few times a day, so no one will be logged in at the time.  But I have the same error if I run the batch file while logged in or not.  The user I am logged in as is the one I specify in the batch file, but again, I get the error when logged in or not and it works when I type the same thing into a command line, specifying the user just like in the batch file.

I just realized, I don't know for sure that I get the "same" error when the batch file runs as a scheduled task, as I don't see the error... only the error in scheduled tasks that it did not run correctly.  I am assuming it's the same error though.

I used to do this same thing on a Windows 2000 server.  What's the difference?!
0
 
LVL 2

Accepted Solution

by:
DiCeR earned 500 total points
ID: 12053973
I believe you can not do drive-mapping and network interactions in a non-interactive session.

I had a similar problem some time ago trying to schedule a copy of files to/from network-drives. It worked interactively. It didnt in a schedule. I ended up working around it with web/ftp-requests which doesent rely on NT-credentials for network-operations.

If you indeed used to do this with a W2K-Server (which I wonder how you managed) and now cannot do it with a W2K3-Server, I believe this has something to do with the access-permissions the scheduler-service runs as.

EE has earlier answered something similar. You might try this approach:
http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_21002545.html
http://www.experts-exchange.com/Programming/Q_20965343.html
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question