Net use command

  • Thread starter Thread starter Byron Kendrick
  • Start date Start date
B

Byron Kendrick

Does any one have a good document explaining the net use commands and login
scripts. Maybe someone can point me to a URL or any good resource.

Thanks
Byron
 
it really is not too complicated. Here is the output from the command line.
Simple mappings to drives are very easy to create and the info below should
get you started. If this doesn't help do you have a specific need we can
help with? Here's a website with some help

http://www.enterpriseitplanet.com/resources/scripts_win/


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}]
 
Thanks. This will be very helpful. I downloaded a copy.

Byron
 
Currently we are not using any logon scripts at all. All mapping in the
past was done on the users local computer. Now we are beginning to have a
need for users to use different computers at different times and I would
like to be able to write a script to change the network drives. I can use
the user manager to assign the H: to their home directory on a server and a
script to assign each user in a department to a departmentally shared volume
designated as P:. What I need to be able to do is make these settings over
ride the locally mapped settings. We are going to start moving everone to a
new server this month and the old one is going away. I would like to:

Drop or delete the old maps that were set up at the workstation with the
user logged in.

H:\\oldserver\userhome
P:\\oldserver\groupshare

and put in

H:\\newserver\userhome (Maybe done through the user manager)
P:\\newserver\groupshare (done with a script)

This way I can move their home directory and group directory at night and
when they log on the next morning they won't know they were moved.

Also can I add a network printer (not LPT on or LPT2 as in net use LPT1:
\\server\printer) through a login script so that it will show up as a
windows printer.

Am I dreaming? I will be glad to supply any more info.

Thanks
Byron



Scott Harding - MS MVP said:
it really is not too complicated. Here is the output from the command line.
Simple mappings to drives are very easy to create and the info below should
get you started. If this doesn't help do you have a specific need we can
help with? Here's a website with some help

http://www.enterpriseitplanet.com/resources/scripts_win/


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}]

--
Scott Harding
MCSE, MCSA, A+, Network+
Microsoft MVP - Windows NT Server

Byron Kendrick said:
Does any one have a good document explaining the net use commands and login
scripts. Maybe someone can point me to a URL or any good resource.

Thanks
Byron
 
Byron said:
Currently we are not using any logon scripts at all. All mapping in the
past was done on the users local computer. Now we are beginning to have a
need for users to use different computers at different times and I would
like to be able to write a script to change the network drives. I can use
the user manager to assign the H: to their home directory on a server and a
script to assign each user in a department to a departmentally shared volume
designated as P:. What I need to be able to do is make these settings over
ride the locally mapped settings. We are going to start moving everone to a
new server this month and the old one is going away. I would like to:

Drop or delete the old maps that were set up at the workstation with the
user logged in.

H:\\oldserver\userhome
P:\\oldserver\groupshare

and put in

H:\\newserver\userhome (Maybe done through the user manager)
P:\\newserver\groupshare (done with a script)

This way I can move their home directory and group directory at night and
when they log on the next morning they won't know they were moved.

Also can I add a network printer (not LPT on or LPT2 as in net use LPT1:
\\server\printer) through a login script so that it will show up as a
windows printer.

Am I dreaming? I will be glad to supply any more info.

Thanks
Byron

Scott Harding - MS MVP said:
it really is not too complicated. Here is the output from the command line.
Simple mappings to drives are very easy to create and the info below should
get you started. If this doesn't help do you have a specific need we can
help with? Here's a website with some help

http://www.enterpriseitplanet.com/resources/scripts_win/


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}]

--
Scott Harding
MCSE, MCSA, A+, Network+
Microsoft MVP - Windows NT Server

Byron Kendrick said:
Does any one have a good document explaining the net use commands and login
scripts. Maybe someone can point me to a URL or any good resource.

Thanks
Byron

Byron, as a rule of thumb, you always want to drop a mapping or
substitution before mapping it in case the user did map it to something
else. Let's say for example you want to map drive letter P: to
\\server1\share1, your script would look like this:

net use P: /d
subst P: /d
net use P: \\server1\share1 /persistent:no

You want to drop substitutions also since it is possible to substitute a
drive letter to a network UNC path. This is extremely rare on W2K and
higher since substitutions to UNC paths is slow as molasses, so no one
in their right mind would do it, but it is not uncommon on NT4 clients
since it is the only way to "map" a drive letter to a folder below a
share.

The persistent switch is the same as the "remap at next login" option
through the gui. You don't want your mappings to be persistent for 2
main reasons. If you choose not to use the net use /d before the
mapping for whatever reason, the script will pause at the mapping asking
if you want to overwrite the existing mapping. If you do use the net
use /d, it will run faster since there should in face be nothing to
disconnect. That line is just there in case, so that your script never
fails.

There is a con2prt.exe utility in the NTx resource kit that can connect
to shared printers rather than capture LPT ports.

hth
 
I have a question re the re-mapping or over riding a mapped drive.

If I have a mapped drive H: - can I setup two (2) net use commands that use
the same device (H:) for different paths?
Example:

Net use h: \\server\folder
Net use h: \\server\folder\sub folder

Byron Kendrick said:
Currently we are not using any logon scripts at all. All mapping in the
past was done on the users local computer. Now we are beginning to have a
need for users to use different computers at different times and I would
like to be able to write a script to change the network drives. I can use
the user manager to assign the H: to their home directory on a server and a
script to assign each user in a department to a departmentally shared volume
designated as P:. What I need to be able to do is make these settings over
ride the locally mapped settings. We are going to start moving everone to a
new server this month and the old one is going away. I would like to:

Drop or delete the old maps that were set up at the workstation with the
user logged in.

H:\\oldserver\userhome
P:\\oldserver\groupshare

and put in

H:\\newserver\userhome (Maybe done through the user manager)
P:\\newserver\groupshare (done with a script)

This way I can move their home directory and group directory at night and
when they log on the next morning they won't know they were moved.

Also can I add a network printer (not LPT on or LPT2 as in net use LPT1:
\\server\printer) through a login script so that it will show up as a
windows printer.

Am I dreaming? I will be glad to supply any more info.

Thanks
Byron



it really is not too complicated. Here is the output from the command line.
Simple mappings to drives are very easy to create and the info below should
get you started. If this doesn't help do you have a specific need we can
help with? Here's a website with some help

http://www.enterpriseitplanet.com/resources/scripts_win/


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}]

--
Scott Harding
MCSE, MCSA, A+, Network+
Microsoft MVP - Windows NT Server

Byron Kendrick said:
Does any one have a good document explaining the net use commands and login
scripts. Maybe someone can point me to a URL or any good resource.

Thanks
Byron
 
Nope.
I have a question re the re-mapping or over riding a mapped drive.

If I have a mapped drive H: - can I setup two (2) net use commands that use
the same device (H:) for different paths?
Example:

Net use h: \\server\folder
Net use h: \\server\folder\sub folder

Currently we are not using any logon scripts at all. All mapping in the
past was done on the users local computer. Now we are beginning to have a
need for users to use different computers at different times and I would
like to be able to write a script to change the network drives. I can use
the user manager to assign the H: to their home directory on a server and
a

script to assign each user in a department to a departmentally shared
volume

designated as P:. What I need to be able to do is make these settings
over

ride the locally mapped settings. We are going to start moving everone to
a

new server this month and the old one is going away. I would like to:

Drop or delete the old maps that were set up at the workstation with the
user logged in.

H:\\oldserver\userhome
P:\\oldserver\groupshare

and put in

H:\\newserver\userhome (Maybe done through the user manager)
P:\\newserver\groupshare (done with a script)

This way I can move their home directory and group directory at night and
when they log on the next morning they won't know they were moved.

Also can I add a network printer (not LPT on or LPT2 as in net use LPT1:
\\server\printer) through a login script so that it will show up as a
windows printer.

Am I dreaming? I will be glad to supply any more info.

Thanks
Byron



message
it really is not too complicated. Here is the output from the command
line.

Simple mappings to drives are very easy to create and the info below
should

get you started. If this doesn't help do you have a specific need we can
help with? Here's a website with some help

http://www.enterpriseitplanet.com/resources/scripts_win/


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}]

--
Scott Harding
MCSE, MCSA, A+, Network+
Microsoft MVP - Windows NT Server


Does any one have a good document explaining the net use commands and

login

scripts. Maybe someone can point me to a URL or any good resource.

Thanks
Byron
 
Either this will work:

Net use h: \\server\folder

or this:

Net use h: "\\server\folder\sub folder"

but not both at the same time, for obvious reasons.

John Leonard - Sage said:
I have a question re the re-mapping or over riding a mapped drive.

If I have a mapped drive H: - can I setup two (2) net use commands that use
the same device (H:) for different paths?
Example:

Net use h: \\server\folder
Net use h: \\server\folder\sub folder

Byron Kendrick said:
Currently we are not using any logon scripts at all. All mapping in the
past was done on the users local computer. Now we are beginning to have a
need for users to use different computers at different times and I would
like to be able to write a script to change the network drives. I can use
the user manager to assign the H: to their home directory on a server
and
a
script to assign each user in a department to a departmentally shared volume
designated as P:. What I need to be able to do is make these settings over
ride the locally mapped settings. We are going to start moving everone
to
a
new server this month and the old one is going away. I would like to:

Drop or delete the old maps that were set up at the workstation with the
user logged in.

H:\\oldserver\userhome
P:\\oldserver\groupshare

and put in

H:\\newserver\userhome (Maybe done through the user manager)
P:\\newserver\groupshare (done with a script)

This way I can move their home directory and group directory at night and
when they log on the next morning they won't know they were moved.

Also can I add a network printer (not LPT on or LPT2 as in net use LPT1:
\\server\printer) through a login script so that it will show up as a
windows printer.

Am I dreaming? I will be glad to supply any more info.

Thanks
Byron



it really is not too complicated. Here is the output from the command line.
Simple mappings to drives are very easy to create and the info below should
get you started. If this doesn't help do you have a specific need we can
help with? Here's a website with some help

http://www.enterpriseitplanet.com/resources/scripts_win/


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}]

--
Scott Harding
MCSE, MCSA, A+, Network+
Microsoft MVP - Windows NT Server

Does any one have a good document explaining the net use commands and
login
scripts. Maybe someone can point me to a URL or any good resource.

Thanks
Byron
 

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

Back
Top