How to use net use

How to use net use

Net use

Applies To: Windows Server 2003, Windows Vista, Windows XP, Windows Server 2008, Windows 7, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2000, Windows Server 2012, Windows 8

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. Used without parameters, net use retrieves a list of network connections.

For examples of how this command can be used, see Examples.

Syntax

Parameters

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.

Specifies the name of the server and the shared resource. If ComputerName 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.

Specifies a NetWare volume on the server. You must have Client Service for NetWare or Gateway Service for Netware (Windows Server) installed and running to connect to NetWare servers.

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.

Specifies a different user name with which the connection is made.

Specifies another domain. If you omit DomainName, net use uses the current logged on domain.

Specifies the user name with which to log on.

Specifies the fully qualified domain name for the domain where the user account exists.

Stores the provided credentials for reuse.

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.

Cancels the specified network connection. If you specify the connection with an asterisk (*), all network connections are canceled.

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.

Connects a user to the home directory.

Displays help for the specified net 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В DeviceName 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В Name«). If you omit quotation marks, an error message appears.

Examples

To assign the disk-drive device name E: to the Letters shared directory on the \\Financial server, type:

To assign (map) the disk-drive device name M: to the directory User2 within the Letters volume on the \\Financial server, type:

To connect the user identifier User1 as if the connection were made from the Accounts domain, type:

To disconnect from the \\Financial\Public directory, type:

To connect to the resource memos shared on the \\Financial 2 server, type:

To restore the current connections at each logon, regardless of future changes, type:

How to Use the Net Use Command in Windows

Net Use command examples, options, switches, and more

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net use

In This Article

Jump to a Section

The net use command is a Command Prompt command used to connect to, remove, and configure connections to shared resources, like mapped drives and network printers.

It’s one of many net commands like net send, net time, net user, net view, etc.

Net Use Command Availability

This command is available from within the Command Prompt in Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP, and in older versions of Windows and in Windows Server operating systems.

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net use

Recovery Console, the offline repair utility in Windows XP, also includes the net use command, but it’s not possible to use it within the tool.

The availability of certain command switches and other command syntax may differ from operating system to operating system.

Net Use Command Syntax

This command uses the following general syntax:

net use [<devicename | *>] [\\computername\sharename[\volume] [<password | *>]] [/user:[domainname\]username] [/user:[dotteddomainname\]username] [/user:[username@dotteddomainname] [/home <devicename | *> [<password | *>]] [/persistent:<yes | no>] [/smartcard] [/savecred] [/delete] [/help] [/?]

Review how to read command syntax if you’re not sure how to interpret the net use command syntax as it’s shown above or described in the table below.

Net Use Command Options
OptionExplanation
net useExecute the net use command alone to show detailed information about currently mapped drives and devices.
devicenameUse this option to specify the drive letter or printer port you want to map the network resource to. For a shared folder on the network, specify a drive letter from D: through Z:, and for a shared printer, LPT1: through LPT3:. Use * instead of specifying devicename to automatically assign the next available drive letter, starting with Z: and moving backward, for a mapped drive.
\\computername\sharenameThis specifies the name of the computer, computername, and the shared resource, sharename, like a shared folder or a shared printer connected to computername. If there are spaces anywhere here, be sure to put the entire path, slashes included, in quotes.
volumeUse this option to specify the volume when connecting to a NetWare server. Client Service for NetWare or Gateway Service for Netware must be installed.
passwordThis is the password needed to access the shared resource on computername. You can choose to enter the password during the execution of the net use command by typing * instead of the actual password.
/userUse this net command option to specify a username to connect to the resource with. If you don’t use /user, net use will attempt to connect to the network share or printer with your current username.
domainnameSpecify a different domain than the one you’re on, assuming you’re on one, with this option. Skip domainname if you’re not on a domain or you want net use to use the one you’re already on.
usernameUse this option with /user to specify the username to use to connect to the shared resource.
dotteddomainnameThis option specifies the fully qualified domain name where username exists.
/homeThis net use command option maps the current user’s home directory to either the devicename drive letter or the next available drive letter with *.
/persistent:<yes | no>Use this option to control the persistence of connections created with the net use command. Choose yes to automatically restore created connections at the next login or choose no to limit the life of this connection to this session. You can shorten this switch to /p if you like.
/smartcardThis switch tells the net use command to use the credentials present on the available smart card.
/savecredThis option stores the password and user information for use next time you connect in this session or in all future sessions when used with /persistent:yes.
/deleteThis net use command is used to cancel a network connection. Use /delete with devicename to remove a specified connection or with * to remove all mapped drives and devices. This option can be shortened to /d.
/helpUse this option, or the shortened /h, to display detailed help information for the net use command. Using this switch is the same as using the net help command with net use: net help use.
/?The standard help switch also works with the net use command but only displays the command syntax, not any detailed information about the command’s options.

Save the output of the net use command to a file using a redirection operator. If you’re not familiar with this operation, review how to redirect command output to a file for guidance.

Net Use Command Examples

Following are a few different ways you might use this command:

Temporary Mapped Drive

In this example, we used the net use command to connect to the my media shared folder on a computer named server. The my media folder will be mapped to the highest available drive letter [*], which in our example happens to be y:, but we don’t want to continue mapping this drive every time we log onto the computer [/persistent:no].

Permanent Mapped Drive

The above is a slightly more complicated example that you might see in a business setting.

In this net use example, we want to map our e: drive to the smithmark shared folder on usrsvr002. We want to connect as another user account we have [/user] by the name of msmith2 that’s stored on the pdc01 domain with a password of Ue345Ii. We don’t want to map this drive manually every time we start the computer [/p:yes], nor do we want to enter the username and password each time [/savecred].

List All Shared Resources

In this simple example of the net use command, we get a list of all the shared resources currently in use under the user account that’s currently logged in. In our example, the result in Command Prompt shows «Z: \\server\shared folder\» since z: is the drive letter that’s connecting to shared folder on server.

The message «There are no entries in this list.» will show if there aren’t any connections currently set up.

Unmap a Drive

An appropriate final example of net use is the removal [/delete] of a currently mapped drive, in this case, p:.

How to Connect to Network Drives on the Command Line with Net Use

Read more tutorials by Adam Bertram!

Table of Contents

The net use command is a legacy, yet still completely functional command to create, remove and manage SMB Windows mapped connections and drives.

Let’s dig into the net use command and cover what it’s capable of and how to use it in this tutorial.

Table of Contents

Prerequisites

To follow along with any examples in this tutorial, ensure you have at least:

The net use command will work in non-domain environments. If not though, you’ll always need to pass a username and password to authenticate to the remote file share.

Getting Started with Net Use

The net use command enables you to work with files on network file shares. It does this using various parameters and switches as shown below.

The net use command can view device connections, create new connections and remove them. Throughout this tutorial, you’re going to learn about each parameter and see in what use case each parameter fits.

Much of the content you’ll see around net use refers to the endpoints it works with as ‘connections’ instead of ‘drives’. This command is capable of connecting to printers and other devices but for this tutorial, you’re going to focus on remote file shares.

Creating Remote Connections

Creating new connections is one of the most common reasons to use the net use command. This command allows you to connect to remote file shares to copy files to, remove from, etc just like if the folder you’re connecting to was local.

Mapping Network Drives Using Logged-In Credentials

Mapping network drives is one of the most common uses of the net use command. This command allows you to map a network drive on the command line much like you would via File Explorer.

Assuming you’re on a Windows 10 PC in a domain environment with a Windows server hosting a file share:

1. Open a command prompt or PowerShell console as administrator.

2. Let’s map the drive letter F: to the DEVSRV server file share C$. To do so, specify the drive letter to map the network drive to followed by the UNC path of the remote file share.

You can use any letter to map the network drive to if it’s not already in use.

3. Now run net use with no parameters to confirm Windows mapped the drive correctly.

4. Open File Explorer and you’ll also now notice a new network location.

If you don’t care what device (drive letter) to map the drive to, you can also use an asterisk ( * ) for the drive letter. Doing so will tell Windows to find the next available drive letter.

Mapping Network Drives Using Alternate Credentials

If you went through the demo above and mapped a network drive, you did so authenticating as the logged on user. But what if you need to authenticate to the remote file share using alternate credentials?

Mapping a network drive authenticating as a non-logged-in user account is nearly the same as with a logged-in account. The only difference is using a couple more parameters.

To map a network drive with alternate credentials, open a command prompt or PowerShell console as an administrator.

Run net use providing:

In the below example, Windows will map the F: drive to the \\DEVSRV\c$ file share authenticating as the test_user account in the domain domain using the password of passwordhere.

Use the /savecred parameter to save the credentials to prevent being prompted the password later.

Create “Deviceless” Connections (No Drive Letter)

Perhaps you need to use a remote file share but you don’t want to map a drive letter to it. In that case, simply remove the drive letter.

Let’s create a file share connection without a drive letter known as a “deviceless” connection. Assuming you’re on a Windows 10 PC in a domain environment with a Windows server hosting a file share:

1. Open a command prompt or PowerShell console as administrator.

2. Create the “deviceless” connection by specifying the UNC path to the remote file share a username and password to authenticate and hitting Enter.

If your client computer and remote Windows server are in an Active Directory domain and you’re logged into your client computer with a domain user account, it doesn’t typically make sense to use net use in this situation. You can already access these resources with no extra steps. But when you need to authenticate with an alternate user account, that’s where it comes in handy.

The connection has been made but if you look in File Explorer, you’ll see no connection. This connection is “deviceless”.

3. Now, confirm the connection has been made by running net use with no parameters. You can see below that Windows knows a connection is there.

At this point you can now navigate and work with the file share just as if it was local to you using the alternate user account credentials.

Persistent Connections

Whenever you establish new connections, Windows can keep those connections around after a reboot or not called persistence. The net use command has a parameter called /persistent that defines whether or not a connection remains after a reboot.

To ensure a connection stays around, add the /persistent parameter to any attempt to create a new connection like:

Mapped drives are not persistent, by default.

Advanced Connection Parameters

Most of the time, you’ll only need the parameters discussed earlier to create a connection. But, you may run into situations where you’ll need to perform some advanced connection tasks

Mapping Drives with Write Through (Forced Unit Access)

Added in Windows 10 build 1809, you can use the /writethrough parameter to map a drive bypassing all OS caches and forcing I/Os through to disk.

Increasing Security

The net use command also has two advanced parameters that increase security; /reguireintegrity and /requireprivacy through a feature called UNC Hardened Access. This feature “tags” information on these shares to inform Multiple UNC Provide (MUP) and UNC providers of additional security requirements

Using the /requireintegrity parameter ensures additional integrity checks to block tampering attacks.

The /requireprivacy parameter instructs net use to use encryption to prevent third parties from seeing any sensitive information in the file share communication.

Removing Network Connections

Finally, if you’ve set up some connection and need to get rid of them, the /delete parameter is your friend. To remove a non-persistent connection, provide the /delete parameter and the UNC path to the network share as shown below.

To remove a mapped drive, provide the drive letter and the mapped drive

Conclusion

You should now have a good idea of just about everything you can do with the net use command. This old-school yet handy command is still in use today and can still help you map network drives in Windows.

Hate ads? Want to support the writer? Get many of our tutorials packaged as an ATA Guidebook.

More from ATA Learning & Partners

Recommended Resources!

Recommended Resources for Training, Information Security, Automation, and more!

Get Paid to Write!

ATA Learning is always seeking instructors of all experience levels. Regardless if you’re a junior admin or system architect, you have something to share. Why not write on a platform with an existing audience and share your knowledge with the world?

ATA Learning Guidebooks

ATA Learning is known for its high-quality written tutorials in the form of blog posts. Support ATA Learning with ATA Guidebook PDF eBooks available offline and with no ads!

How to work with Net Use command

PRODUCTS

SOLUTIONS

DOWNLOADS

PURCHASE

TIPS & TRICKS

DEVELOPMENT

SUPPORT

Может перейти на российский сайт? Там цены ниже.

Net Use Command

Net use command description

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.

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net use

Net use command syntax:

net use [] [\\COMPUTER\SHARE[\VOL]] []] [/USER:[DOMAIN\]USER] [/USER:[DOTTEDDOMAIN\]USER] [/USER: [USER@DOTTEDDOMAIN] [/SAVECRED] [/SMARTCARD] [>]

net use [/PERSISTENT:]

Advanced LAN Instant Messenger
Terminal server compatible
Command line interface
Read-only / Reply-only modes
No server required
Ideal for Office Intranet
LanTalk NET messenger

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: : 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:

How To Use Net Use Command In Windows Command Line?

Syntax

net use command has following usage syntax. We will provide the drive name and the path we want to use.

We can get some help about net use command by using /? parameters like below.

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net usenet use Help

List Currently Existing Shares

We will start by listing currently existing, joined or mounted remote shares. We will just use net use command like below.

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net useList Currently Existing Shares

Join or Mount A Remote File Share

We will start with a simple example by mounting a remote file share into our local system. We will mount file share named Backup which resides at 192.168.145.162

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net useJoin or Mount A Remote File Share

Join File Share with Specified User

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net useJoin File Share with Specified User

There will also also some information about the mount like Status, Connections, Resource type.

OR we can also provide the user password explicitly. Keep in mind that providing password in clear text is a security problem. Password will be 123456Aa.

Join File Share Persistently

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net useJoin File Share Persistently

Join File Share and Specify Drive Letter

Up to now we have not specified a local drive letter to the mounted or joined remote share. The default behavior is providing a drive letter in a row manner. We can specify the drive letter like :W or :Z like below.

Make All Future Connections Persistent

The default behavior of the net use command is making connections not persistent. If we want to make all future connection persistent without specifying persistent option explicitly we need to enable persistence globally like below.

Join Printer Share

Printers also a remote resource which can be used by multiple computers like file shares. We can use net use command in order to join a printer into local system. We just provide the printer IP address or host name.

Disconnect From A File or Printer Share

If we want to remove, delete or disconnect from all ready connected share we can use /delete option. We also need to specify the share letter we want to remove. In this example we will remote share named :z like below.

Disconnect and Close All Shares

We may need to removei close and disconnect all currently mounted shares. We will use * with the /delete like below.

How to use net use. Смотреть фото How to use net use. Смотреть картинку How to use net use. Картинка про How to use net use. Фото How to use net useDisconnect and Close All Shares

There is a confirmation mechanism which will ask us that whether we want to continue removal of the remote shares.

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *