Map Network Drive with “net use” Command In Windows

One of the powerful features of the Windows operating systems is sharing and mapping drives over the network. These network shares can be easily consumed by other network hosts like Windows, Modem, TV, Smartphone, etc. The “net use” command is used to mount and map windows shares over the network.

net use Command Syntax

Before starting to use the “net use” command lets take a look the syntax of this command.

net use DRIVE SHARE OPTIONS
  • DRIVE is the local system drive letter where the remote SHARE will be mounted. This parameter is required. The drive letter is case insensitive which means uppercase or lowercase are the same.
  • SHARE is the remote windows share URI which contains the remote share domain name or IP address with the share path. This parameter is required. The share is case insensitive which means uppercase or lowercase are the same.
  • OPTIONS is used to set different options like username, persistent share, etc. This parameter is optional.

Map/Mount Network Drive Into Local Path/Directory

First, we will mount or map a remote network share into the local system. The remote share will be mounted into the local drive which requires a drive letter. Generally, the C:\ and D:\ can be used by local drives. Starting from the Z:\ drive letter is a good habit. The remote network share can be specified with a domain name which should be resolved properly or an IP address. Also, the network share path should be added too. In the following example we will use the networkshare of the remote system “192.168.146.129” which is named as “Backups“.

net use Z: \\192.168.146.129\Backups

If the mount is completed successfully following output or message will be printed to the command-line interface.

The command completed successfully.

We can also check if the given remote network share is mounted into the specified drive letter which is Z: in this case. We will use the dir command to list mounted share contents.

dir Z:\
List Network Share Contents

Map/Mount Network Drive Into Local Path/Directory with Different User

By default the remote network share is mounted without authentication or current user privileges username and password. But we may need to specify different user name and password than the current user. The username and password can be specified with the /user: option where user name provided after the option and password is provided next parameter. In the following example we will use the username “ismail” and password “NotSecure“. Using double quotos is very good practice for specifying the username and password.

net use Z: \\192.168.146.129\Backups /user:ismail "NotSecure"

Map/Mount Network Drive Into Local Path/Directory with For Domain Users

Corporations generally use general network shares for their workers. These users are integrated into the Active Directory or Domain and the share authentication can be done via the Domain user. The “net use” command can be used to authenticate with a different domain user similar to the different local user. In the following example, the domain is named “windowstect.com” and user is “ismail”.

net use Z: \\192.168.146.129\Backups /user:windowstect.com\ismail

Map/Mount Remote System Drive (C: or D:)

If you have administrator-level access to the remote system you can directly map the remote system-specific partition or drive letter like C: or D:. For example to mount remote system C: drive using the following command.

net use Z: \\192.168.146.129\C$ /user:Administrator "NotSecure"

Map/Mount Network Drive Into Local Path/Directory Persistently

By default net use command mapped or mounted network shares are not persistent or temporary. This means they will lost after a reboot. If you require the network shares mappings to be persistent and exist after reboots you can use the /persistent:Yes option.

net use Z: \\192.168.146.129\Backups /persistent:Yes

Make Network Mount/Map Non-persistent or Temporary

If you have a persistent network mount or map and want to make it non-persistent or temporary the /persistent:No can be used for this. This will not remove the mounted network share change changes to the temporary.

net use Z: \\192.168.146.129\Backups /persistent:No

List Mounted/Mapped Network Shares

Currently mapped or mounted network shares can be listed with the “net use” command. This command provides following information about the network shares.

net use

The output is like below.

Status       Local     Remote                               Network
 OK           Z:        \192.168.146.129\Backups     Microsoft Windows Network
 The command completed successfully.
  • Status shows whether the share is active and working properly.
  • Local is the local drive letter where the remote share is mounted.
  • Remote is the remote system and share name which is mounted into the local drive letter.
  • Network is the mount network protocol like SMB or Microsoft Windows Network.

Unmap/Unmount Network Share

Specific network share can be removed or unmounted by using the /delete option. We just need to provide the local drive letter of the network share. This can work for both persistent and temporary shares.

net use Z: /delete

Unmap/Unmount All Network Shares

If you want to remove or unmount all network shares you can use the wildcard * character in order to specify all shares and use the /delete option to remove them. Here we do not specify any specif drive letter to unmount as we want to unmount all network shares.

net use * /delete

Leave a Comment