Network Administration: Net Use Command

In the Windows Server 2008 environment the Net Use command connects to or disconnects from a shared resource on another computer and maps the resource to a drive letter. Here’s the complete syntax:

net use [{drive | *}]
        [{ComputerNameShareName]
        [{Password | *}]]
        [/user:[DomainName]UserName]
        [/savecred]
        [/smartcard]
        [{/delete | /persistent:{yes | no}}]

To set up a home directory, use this syntax:

net use [drive [/home[{password | *}] 
        [/delete:{yes | no}]]

And to control whether connections should be persistent, use this:

net use [/persistent:{yes | no}]

Here’s what the parameters do:

  • DeviceName: Specifies the drive letter. (Note that for a printer, you should specify a printer device such as LPT1: here instead of a drive letter.) If you specify an asterisk, Windows will determine what drive letter to use.

  • \ComputerNameShareName: The server and share name to connect to.

  • Password: The password needed to access the shared resource. If you use an asterisk, you’re prompted for the password.

  • User: Specifies the username to use for the connection.

  • Savecred: Saves the credentials for reuse later if the user is prompted for a password.

  • Smartcard: Specifies that the connection should use a smart card for authorization.

  • Delete: Deletes the specified connection. If you specify an asterisk (*), all network connections are canceled.

  • Persistent: Specifies whether connections should be persistent.

  • Home: Connects to the home directory.

To display all current connections, type net use with no parameters.

The following example shows how to create a persistent connection to a drive named Acct on a server named Server01, using drive K:

C:>net use k: \Server01Acct /persistent: yes

The following example drops the connection:

C:>net use k: /delete