Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

using NET USE to map a network drive, how can I pass parameters i.e. username/password to this command?

Posted on 2004-11-30
11
Medium Priority
?
641 Views
Last Modified: 2011-09-20
Hello,
   I have several machines who connect to our network via an outside VPN connection, when they connect the then run the following by going to START -> RUN...

NET USE X: \\192.168.0.1\sharedrive

This then connects them to this mapped drive, but only after they enter the username/password to access this drive, can I enter all this into a batch file to enable them to run one program and it does everything for them?  We've tried a batch file with just:

NET USE X: \\192.168.0.1\sharedrive

This doesn't even prompt them for a username/password - it just won't work.

Many Thanks

DB
0
Comment
Question by:fsbsupport
  • 4
  • 4
8 Comments
 
LVL 97

Expert Comment

by:Lee W, MVP
ID: 12705291
net use x: \\192.168.0.1\sharedrive password /user:domain\username
0
 
LVL 97

Accepted Solution

by:
Lee W, MVP earned 1000 total points
ID: 12705295
net use x: \\192.168.0.1\sharedrive * /user:domain\username

This will prompt the user for a password.
0
 
LVL 58

Assisted Solution

by:Pete Long
Pete Long earned 1000 total points
ID: 12705298
Mapping Drives and Printers From Command

*****Drives*****

These command can be executed from either command line, Batch File OR Login Scripts

This command maps a drive "Z:\" to a shared directory on a server called "Server1"

net use z: \\server1\sharename\

If you need permissions to use this network resource toy can also enter the username and password. (See Security Below)

net use z: \\server1\sharename\ /user:username password

The above commands will work until a user logs out or the machine is rebooted, to make the mapping permanent you need to use a "Persistent switch"

net use z: \\server1\sharename\ /user:username password /Y

*****Printers*****

The Syntax is the same but this time you are mapping an "lpt" port (Line Printer Terminal) All the rules above apply so the full command is,

net use lpt1 \\machinename\sharename\ /user:username password /Y

or

RUNDLL32 PRINTUI.DLL,PrintUIEntry /dn /n\\COMPUTERNAME\PRINTERNAME      // removes printer    
RUNDLL32 PRINTUI.DLL,PrintUIEntry /in /n\\COMPUTERNAME\PRINTERNAME       // adds printer

Zero Administration Kit
http://www.microsoft.com/ntworkstation/downloads/Recommended/Featured/NTZAK.asp

How to Use Con2prt.exe to Connect to a Network Printer
http://support.microsoft.com/?kbid=181663


*****Security*****

If you do need to use  username and password, this has obvious security implications, Consider using NSIS
http://nsis.sourceforge.net/site/Download.6.0.html

For instructions on its use see http://www.experts-exchange.com/Operating_Systems/Win2000/Q_20710867.html
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 58

Expert Comment

by:Pete Long
ID: 13252136
spli leew & PeteLong
0
 
LVL 97

Expert Comment

by:Lee W, MVP
ID: 13252162
works for me
0
 
LVL 58

Expert Comment

by:Pete Long
ID: 13252175
do you ever sleep :)
0
 
LVL 97

Expert Comment

by:Lee W, MVP
ID: 13252184
No... actually, only around the prime EE hours of 8am to noon ET.
0
 
LVL 58

Expert Comment

by:Pete Long
ID: 13256365
:)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

572 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