Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot Map Drive Via Login Script 1

Status
Not open for further replies.

TripleJHJO

Programmer
Jan 10, 2003
76
US
I cannot get a drive mapped to a shared folder on a server via a login script. The user is logging on through a domain, and the share is on a file server in that domain.


I have tried the following examples:
net use p: \\servername\sharename
net use p: \\servername\sharename /user:domain\username

I get the following message:
Logon failure: unknown user name or bad password.

If I map the share manually through windows explorer, it works fine. However I want to automate it via a batch file that is run at login.

 
try
net use p: \\servername\sharename\username
or
net use p: \\servername\sharename\%username%


since it is nothign but a antoher share


:--------------------------------------------------------------------------:
fugitive.gif

ok,ok...I did shoot the deputy but he told me he was the sheriff!
:--------------------------------------------------------------------------:
 
I tried them, but still received the same error.
Any other suggestions?
 
make sure that user has rights to the share...
make sure that machine is part of the domain...

sounds odd that ur not getting the same error while mapping it

:--------------------------------------------------------------------------:
fugitive.gif

ok,ok...I did shoot the deputy but he told me he was the sheriff!
:--------------------------------------------------------------------------:
 
I have tried the following examples:
net use p: \\servername\sharename
net use p: \\servername\sharename /user:domain\username

The above should work.

When you map drives via a logon script, the would be run under the users context. This means that is the user account has rights to the share, then you do not have to provide username and password.

The bat file should include a net use p: /delete to verify that the P: drive is free.

net use P: /delete
net use p: \\servername\sharename


If this is not working, then the user does not have rights to the share.

C:\Documents and Settings\poandjo>net use /?
The syntax of this command is:


NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]




Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please contact (Sales@njcomputernetworks.com)
 
I have tried those from the command line and still get the error stated above.
The user has rights to the share and the computer is part of the domain.

What is strange is that, through windows explorer, I can map the drive through tools->map network drive and it will reconnect the next time that the user logs in. However, when I try to put it in the script or run it from the command line - it fails.

Thanks.
 
When you logged in as the user, go to a command prompt:

Type this:

net use p: \\servername\sharename

Does it work?

Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please contact (Sales@njcomputernetworks.com)
 
No, that is what I am saying. I log in as the user. I type it at the command prompt or in the login batch file - it does not work.

Go into windows explorer and map it - it works. Arghhh!!!

This has me completely baffled.

Thanks.
 
Add this to the begging of your script. I think your drive mappings are trying to recconect from previous states and not trying to accept the connections from you batch files.

net use /p:no /y
 
Well, I have found what is causing my hiccup, but I am not sure how to work with it.
It seems as though the space that I was using in the share name (User Documents) was causing the problem. Are spaces not allowed?, or is there a way to work with them through bracketing?

Thanks for all your input.
 
Just put quotes around the server and share name:

net use j: "\\servername\share name"



Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please contact (Sales@njcomputernetworks.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top