Logging into network drives with net use

G

Guest

I have a few network drives that I want to login to at startup, but I don't
necessarily want to remap them. I have tried using the net use command...

net use z:\\##.##.##.##\folder /user:domain\admin "password"

....but that tries to remap the drive. I only want a script that logs into
all of my network drives, what would that command be?

Thanks
 
P

Pegasus

Adam said:
I have a few network drives that I want to login to at startup, but I don't
necessarily want to remap them. I have tried using the net use command...

net use z:\\##.##.##.##\folder /user:domain\admin "password"

...but that tries to remap the drive. I only want a script that logs into
all of my network drives, what would that command be?

Thanks

Your question is not very clear but perhaps this will help:

net use \\##.##.##.##\folder /user:domain\admin "password"

Note that your original command won't work, because you
omitted the space after the drive letter. The correct command
goes like this:

net use z: \\##.##.##.##\folder /user:domain\admin "password"
 
G

Guest

I believe the missing space after can be attributed to Lazy Thumb Syndrome
(LTS).

I will try to be more descriptive in what I need done. Right now the
command...

net use z: \\##.##.##.##\folder /user:domain\admin "password"

.... does two things. It maps a network drive to drive Z: AND it logs into
that drive with a username and password. I need a command (if there is such a
command) that will only do the latter. All my network drives are already
mapped, I just want a command that will login to them.

Thanks
 
R

RedForeman

I believe the missing space after can be attributed to Lazy Thumb Syndrome
(LTS).

I will try to be more descriptive in what I need done. Right now the
command...

net use z: \\##.##.##.##\folder /user:domain\admin "password"

... does two things. It maps a network drive to drive Z: AND it logs into
that drive with a username and password. I need a command (if there is such a
command) that will only do the latter. All my network drives are already
mapped, I just want a command that will login to them.

Thanks









- Show quoted text -

Here's an almost brilliant idea, and it's considered a best practice,
and why I don't see the 'MVP' 's talking about it, is beyond me...

In a networked environment, it's common to have a startup.bat or
logon.cmd as a startup script, that does numerous things, map drives,
setup printers, sync folders, set the official time, etc... Do you
have an Windows Active Directory environment? if so, your DC will be
none the wiser and your computers will always be on the same time....
I'll see if I can't find ours here....

I would suggest you taking 10 minutes and write a startup script the
right way... For every drive you have mapped, document them and then
delete them using your script...

Your script should start out like this, deleting your mapped drives
first, then remapping them.... that doesn't actually bring up your
window, but it does 2 things. Maps, and authenticates...

There is a potential that this will add several seconds to your boot,
but I've grown quite used to it..

Here is a snippit of our logon script... it too uses UNC(universal
naming convention) instead of IP, words either way
=====================
@echo off
net use f: /delete /yes
net use h: /delete /yes
net use i: /delete /yes
net use j: /delete /yes
net use k: /delete /yes
net use l: /delete /yes
net use m: /delete /yes
net use n: /delete /yes
net use p: /delete /yes
net use q: /delete /yes
net use r: /delete /yes
net use s: /delete /yes
net use t: /delete /yes
net use u: /delete /yes
net use v: /delete /yes
net use x: /delete /yes
net use z: /delete /yes
net time \\fs-2 /set /yes
net use f: \\fs-1\ntvol
net use h: \\fs-1\pbg$
net use i: \\fs-1\share
net use j: \\fs-1\wpdata
net use k: \\fs-8\ppc_aa
net use l: \\fs-1\clidata
net use n: \\fs-8\cdroms
net use p: \\fs-2\ntvol
net use q: \\scan\ntvol
net use x: \\fs-1\archive
net use z: \\fs-1\cbh

==============

RedForeman
 
P

Pegasus

RedForeman said:
Here's an almost brilliant idea, and it's considered a best practice,
and why I don't see the 'MVP' 's talking about it, is beyond me...

In a networked environment, it's common to have a startup.bat or
logon.cmd as a startup script, that does numerous things, map drives,
setup printers, sync folders, set the official time, etc... Do you
have an Windows Active Directory environment? if so, your DC will be
none the wiser and your computers will always be on the same time....
I'll see if I can't find ours here....

I would suggest you taking 10 minutes and write a startup script the
right way... For every drive you have mapped, document them and then
delete them using your script...

Your script should start out like this, deleting your mapped drives
first, then remapping them.... that doesn't actually bring up your
window, but it does 2 things. Maps, and authenticates...

There is a potential that this will add several seconds to your boot,
but I've grown quite used to it..

Here is a snippit of our logon script... it too uses UNC(universal
naming convention) instead of IP, words either way
=====================
@echo off
net use f: /delete /yes
net use h: /delete /yes
net use i: /delete /yes
net use j: /delete /yes
net use k: /delete /yes
net use l: /delete /yes
net use m: /delete /yes
net use n: /delete /yes
net use p: /delete /yes
net use q: /delete /yes
net use r: /delete /yes
net use s: /delete /yes
net use t: /delete /yes
net use u: /delete /yes
net use v: /delete /yes
net use x: /delete /yes
net use z: /delete /yes
net time \\fs-2 /set /yes
net use f: \\fs-1\ntvol
net use h: \\fs-1\pbg$
net use i: \\fs-1\share
net use j: \\fs-1\wpdata
net use k: \\fs-8\ppc_aa
net use l: \\fs-1\clidata
net use n: \\fs-8\cdroms
net use p: \\fs-2\ntvol
net use q: \\scan\ntvol
net use x: \\fs-1\archive
net use z: \\fs-1\cbh

==============

RedForeman

One reason why MVPs will not suggest your batch file is that
it unnecessarily slows down the logon process. Instead of having
18 separate commands to disconnect existing connections, they
might suggest a single line:

net use * /del /yes

or even better these two once-only instructions:
net use /persistent:no
net use * /del /yes

in which case connections are not remembered at all, thus eliminating
the need to delete them in future.

About your remaining 12 lines: I thought the OP specifically
did NOT want to map shares to drive letters but perhaps
I misread his clarification. I'll wait for his reply.
 
G

Guest

Red,

I would like to do something like this actually, but my main problem is that
all of our network drives do not have a solid naming convention. Basically I
wouldn't know one from the other except by IP address, which I don't really
want to memorize.

If it were possible to rename the network drive in the same script that
remaps them, I would totally go that route, otherwise I am stuck with what I
had before.

I guess my question is; Is there a way to rename mapped network drives
within this same script that you propose?

Regards
 
P

Pegasus

Adam said:
Red,

I would like to do something like this actually, but my main problem is
that
all of our network drives do not have a solid naming convention. Basically
I
wouldn't know one from the other except by IP address, which I don't
really
want to memorize.

If it were possible to rename the network drive in the same script that
remaps them, I would totally go that route, otherwise I am stuck with what
I
had before.

I guess my question is; Is there a way to rename mapped network drives
within this same script that you propose?

Regards

Are you replying to Red or to me?
 
G

Guest

My bad, replied to wrong response; However, if you know the answer then I am
glad I replied to you :)
 
P

Pegasus

I suspect the answer is "no" but I can't tell for sure
unless you give an actual example.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top