کد:
http://www.cezeo.com/tips-and-tricks/net-use-command/
Net use command connects / disconnects the computer from a shared resource, or allow to view the information about current computer connections. This command also can controls persistent network connections. If you will use net use command without any parameters, you will retrieves a list of network current connections.


Net use command syntax:


net use [{DEVICE | *}] [\\COMPUTER\SHARE[\VOL]] [{PASSWORD | *}]] [/USER:[DOMAIN\]USER] [/USER:[DOTTEDDOMAIN\]USER] [/USER: [USER@DOTTEDDOMAIN] [/SAVECRED] [/SMARTCARD] [{/DELETE | /PERSISTENT:{yes | no}}]
net use [DEVICE [/HOME[{PASSWORD | *}] [/DELETE:{yes | no}]]
net use [/PERSISTENT:{yes | no}]

Net use command parameters:

DEVICE : Assigns a name to connect to the resource or specifies the device to be disconnected. There are two kinds of device names: disk drives (that is, D: through Z and printers (that is, LPT1: through LPT3. Type an asterisk (*) instead of a specific device name to assign the next available device name.
\\COMPUTER\SHARE : Specifies the name of the server and the shared resource. If COMPUTER contains spaces, use quotation marks around the entire computer name from the double backslash (\\) to the end of the computer name (for example, "\\Computer Name\Share Name"). The computer name can be from 1 to 15 characters long.
\VOL : Specifies a NetWare volume on the server. You must have Client Service for NetWare installed and running to connect to NetWare servers.
PASSWORD : Specifies the password needed to access the shared resource. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when you type it at the password prompt.
/USER : Specifies a different user name with which the connection is made.
DOMAIN : Specifies another domain. If you omit DOMAIN, net use uses the current logged on domain.
USER : Specifies the user name with which to log on.
DOTTEDDOMAIN : Specifies the fully-qualified domain name for the domain where the user account exists.
/SAVECRED : Stores the provided credentials for reuse.
/SMARTCARD : Specifies the network connection is to use the credentials on a smart card. If multiple smart cards are available, you are asked to specify the credential.
/DELETE : Cancels the specified network connection. If you specify the connection with an asterisk (*), all network connections are canceled.
/PERSISTENT:{yes | no} : 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 are restored at the next logon. Use /DELETE to remove persistent connections.
/HOME : Connects a user to the home directory.
net help command : Displays help for the specified net command.

Net use command Remarks:

Connecting and disconnecting from a network resource
Use net use to connect to and disconnect from a network resource, and to view your current connections to network resources. You cannot disconnect from a shared directory if you use it as your current drive or an active process is using it.
=> Viewing connection information
To view information about a connection, you can do either of the following:
=> Type net use DEVICE to get information about a specific connection.
=> Type net use to get a list of all the computer's connections.
=> Using deviceless connections
Deviceless connections are not persistent.
=> Connecting to NetWare servers
After you install and run Client Service for NetWare, you can connect to a NetWare server on a Novell network. Use the same syntax that you use to connect to a Windows Networking server, except you must include the volume you to which you want to connect.
=> Using quotation marks
If the ServerName that you supply contains spaces, use quotation marks around the text (that is, "SERVER"). If you omit quotation marks, an error message appears.

How Authentication Works for Net Use Command


When you use the NET USE command to connect to a share on a server in a domain, the following authentication process verifications take place:
=> If the client's user name is in the domain's UAS account database, the passwords are compared. If the passwords match, access is allowed to the share. If the passwords do not match, an access denied message is returned.
The behavior allows for backward compatibility with Windows for Workgroups and other clients. These clients do not pass the domain name to the Server.
=> If the client's user name does not match a user name in the domain's UAS, the domain controller checks to see if the client's domain is listed in its trust list. If the client's domain name is on the target domain's trust list, the domain controller communicates with the other domain to see if the client's user account and password are valid. If so, access is allowed to the share. If not, an access denied message is returned.

Net Use Command examples

To assign the disk-drive device name E: to the Letters shared directory on the \\Fin server, type:
net use e: \\fin\letters
To assign (map) the disk-drive device name M: to the directory Mike within the Letters volume on the \\Fin NetWare server, type:
net use m: \\fin\letters\mike
To connect the user identifier Dan as if the connection were made from the Accounts domain, type:
net use d:\\server\share /USER:Accounts\Dan
To disconnect from the \\Fin\Public directory, type:
net use f: \\fin\public /DELETE
To connect to the resource memos shared on the \\Fin 3 server, type:
net use k: "\\fin 3" \memos
To restore the current connections at each logon, regardless of future changes, type:
net use /PERSISTENT:yes





موضوعات مشابه: