---
title: "How to Connect to Network Drives on the Command Line with Net Use"
description: "If you need to map a network drive or connect to network device over the SMB protocol, the net use command may be for you."
canonical: "https://adamtheautomator.com/net-use/"
---

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

> If you need to map a network drive or connect to network device over the SMB protocol, the net use command may be for you.

Source: https://adamtheautomator.com/net-use/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![How to Connect to Network Drives on the Command Line with Net Use](https://adamtheautomator.com/wp-content/uploads/2021/04/How-to-Connect-to-Network-Drives-on-the-Command-Line-with-Net-Use.jpg)

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

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)6 April 20216 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Windows Client](/tag/windows-client/)[windows server](/tag/windows-server/)

Table of Contents

*   [Prerequisites](#h-prerequisites)
*   [Getting Started with Net Use](#h-getting-started-with-net-use)
*   [Creating Remote Connections](#h-creating-remote-connections)
*   [Mapping Network Drives Using Logged-In Credentials](#h-mapping-network-drives-using-logged-in-credentials)
*   [Mapping Network Drives Using Alternate Credentials](#h-mapping-network-drives-using-alternate-credentials)
*   [Create “Deviceless” Connections (No Drive Letter)](#h-create-deviceless-connections-no-drive-letter)
*   [Persistent Connections](#h-persistent-connections)
*   [Advanced Connection Parameters](#h-advanced-connection-parameters)
*   [Mapping Drives with Write Through (Forced Unit Access)](#h-mapping-drives-with-write-through-forced-unit-access)
*   [Increasing Security](#h-increasing-security)
*   [Removing Network Connections](#h-removing-network-connections)
*   [Conclusion](#h-conclusion)

One of the most ubiquitous commands in a senior Windows admin’s arsenal is probably the Windows [`net` command](https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/net-commands-on-operating-systems). This command has a lot of functionality. In this article, you’re going to learn about `net use`.

Not a reader? Watch this related video tutorial!

**_Not seeing the video? Make sure your ad blocker is disabled._**

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.

## Prerequisites

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

*   A Windows client computer (any version will work) in an Active Directory domain. This tutorial will use Windows 10.

> _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._

*   One or more [available file shares](https://www.businessnewsdaily.com/11020-create-file-share-windows-server-2016.html) on an accessible server part of an Active Directory domain. This tutorial will be connecting to an [administrative file share](https://en.wikipedia.org/wiki/Administrative_share) called _C$_ on a server called _DEVSRV_.
    
*   A user account with read access to the file share and NTFS read permissions to the folder the share is pointing to
    

## 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.

![Using net help to find net use parameters](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T143928.841.png)

Using net help to find net use parameters

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.

To create a new remote file share connection, you have two options with `net use`. You can either create what Microsoft calls a “deviceless” connection which is simply a file share connection without a drive letter or a mapped drive.

### 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](https://support.microsoft.com/en-us/windows/map-a-network-drive-in-windows-29ce55d1-34e3-a7e2-4801-131475f9557d).

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.

Related:[How to Run PowerShell as Administrator](https://adamtheautomator.com/powershell-run-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](https://www.pcmag.com/encyclopedia/term/unc) of the remote file share.

```powershell
net use f: \\DEVSRV\c$
```

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

> _If the file share has spaces in it, always be sure to surround it in quotes e.g. `\\DEVSRV\"My File Share"`._

![Mapping the Drive](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T144307.043.png)

Mapping the Drive

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

![Run Net Use](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T144429.442.png)

Run Net Use

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

![Open File Explorer](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T144515.322.png)

Open File Explorer

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.

![Use asterisk for the Drive Letter](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T144603.222.png)

Use asterisk for the 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:

*   The drive letter to map to
*   The UNC path of the file share
*   The username to authenticate with (`/u`)
*   The password

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_.

```powershell
net use f: \\DEVSRV\c$ /u:domain\\test_user passwordhere
```

> _Specify a local user account on the remote computer by removing the domain from the username parameter e.g. `/u:test_user`._

> _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.

Related:[How to Run PowerShell as Administrator](https://adamtheautomator.com/powershell-run-as-administrator/)

2\. Create the “deviceless” connection by specifying the [UNC path](https://www.pcmag.com/encyclopedia/term/unc) to the remote file share a username and password to authenticate and hitting Enter.

```powershell
net use \DEVSRV\c$ /u:domain\test_user passwordhere
```

> _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”.

![Connection is Deviceless](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T144937.840.png)

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.

![Confirm the Connection](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T145106.402.png)

Confirm the Connection

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.

![Navigate and work with the file share](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T145214.948.png)

Navigate and work with the file share

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

```powershell
net use \\DEVSRV\c$ /persistent:yes
```

> _Mapped drives are not persistent, by default._

> _Windows will remember the last created connection’s persistence setting. If you set `/persistent` to `yes` for a connection, all subsequent connections will be persistent if you do not explicitly set `/persistent` to `no`. To ensure all connections are persistent in the current session, use_ `net use /persistent:yes`.

### 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](https://www.mdmandgpanswers.com/blogs/view-blog/how-to-enable-unc-hardened-access-to-prevent-jasbug-ms15-011kb3000483-ms15-014kb3004361)_. 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.

```powershell
net use /delete \\devsrv\c$
```

![Removing Network Connections](https://adamtheautomator.com/wp-content/uploads/2021/04/Untitled-2021-04-05T145419.673.png)

Removing Network Connections

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

```powershell
net use f: \\devsrv\c$ /delete 
```

## 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.

How are you going to use `net use`?

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fnet-use%2F&text=How%20to%20Connect%20to%20Network%20Drives%20on%20the%20Command%20Line%20with%20Net%20Use)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fnet-use%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fnet-use%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2021/05/Wrangling-NetBIOS-With-the-nbtstat-Utility.jpg)

### [Wrangling NetBIOS With the nbtstat Utility](/nbtstat/)

Do you need to retrieve NetBIOS statistics to help you analyze and troubleshoot name resolution problems? The nbtstat command line tool can you do just that. Learn how to use nbtstat and its many switches in this tutorial.

![](https://adamtheautomator.com/wp-content/uploads/2021/05/How-to-Convert-MBR-to-GPT-and-GPT-to-MBR-Step-by-Step.jpg)

### [How to Convert MBR to GPT and GPT to MBR \[Step-by-Step\]](/convert-mbr-to-gpt/)

Have you purchased a new hard drive but cannot access all of its disk space? Luckily for you, this article will teach you how to convert MBR to GPT.

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
