Click to See Complete Forum and Search --> : Connecting to UNC Path (Network ?)
ksutton
Jul 10th, 2000, 02:57 PM
How can I specify the User/Password to connect to a UNC path?
I am copying files from several machines and am accessing an admin share on each machine. I need to be able to programmatically specify the admin User & Pwd to connect with.
Thanks!
KWell
Jul 11th, 2000, 01:04 AM
You can use the Net Use command (come from the WinNT Help)
Net Use
Connects a computer to or disconnects a computer from a shared resource, or displays information about computer connections. The command also controls persistent net connections.
net use [devicename | *] [\\computername\sharename[
\volume]] [password | *]] [/user:[domainname\]
username] [[/delete] | [/persistent:{yes | no}]]
net use devicename [/home[password | *]] [/delete:{
yes | no}]
net use [/persistent:{yes | no}]
Parameters
none
Type net use without parameters to get a list of network connections.
devicename
Assigns a name to connect to the resource or specifies the device to be disconnected. There are two kinds of devicenames: disk drives (D: through Z:) and printers (LPT1: through LPT3). Type an asterisk instead of a specific devicename to assign the next available devicename.
\\computername\sharename
Is the name of the server and the shared resource. If the computername contains blank characters, enclose the double backslash (\\) and the computername in quotation marks (" "). The computername may be from 1 to 15 characters long.
\volume
Specifies a NetWare volume on the server. You must have Client Service for NetWare (Windows*NT Workstation) or Gateway Service for NetWare (Windows*NT Server) installed and running to connect to NetWare servers,
password
Is the password needed to access the shared resource.
*
Produces a prompt for the password. The password is not displayed when you type it at the password prompt.
/user
Specifies a different username with which the connection is made.
domainname
Specifies another domain. For example, net use d: \\
server\share /user:admin\mariel connects the user mariel as if the connection were made from the admin domain. If domain is omitted, the current logged on domain is used.
username
Specifies the username with which to log on.
/home
Connects a user to their home directory.
/delete
Cancels the specified network connection. If the user specifies the connection with an asterisk, all network connections are cancelled.
/persistent
Controls the use of persistent network connections. The default is the setting used last. Deviceless connections are not persistent.
yes
Saves all connections as they are made, and restores them at next logon.
no
Does not save the connection being made or subsequent connections; existing connections will be restored at next logon. Use the /delete switch to remove persistent connections.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.