net use maps a network share to a drive letter, lists what is already mapped, and disconnects it again. That part takes thirty seconds to learn. What takes years to learn is why the drive works for you and not for the service, why the same command fails with error 1219 on the second share, and why a mapping that Explorer shows as connected is unreachable from an elevated prompt.
All three have the same root cause. A drive letter is not a property of the machine. It belongs to one logon session, and Windows has more logon sessions than most people expect.
This page covers the command, and then the four behaviours that turn a mapped drive into an afternoon.
Applies to: Windows 10 / 11 and Windows Server 2016 / 2019 / 2022 / 2025
Quick answer
rem Map a share to a drive letter for this session only
net use Z: \\SRV-FILE01\Finance /persistent:no
rem What is currently mapped, and whether it is actually connected
net use
rem Disconnect one, or all of them
net use Z: /delete
net use * /delete /y
None of these need elevation. That turns out to matter, because a mapping made in an elevated prompt is not the same mapping.
What net use does
It creates a symbolic link object that maps a drive letter to a UNC path, inside the current logon session, and authenticates the connection while doing it. The credential and the drive letter are two separate things, and they fail in different ways.
| Parameter | What it does |
|---|---|
Z: or * | The drive letter to use. * takes the next free one. |
\\server\share | The UNC path. Quote it if the server name contains a space. |
/user:DOMAIN\user | Authenticate as someone other than the logged-on user. |
* in place of the password | Prompt for it instead of putting it on the command line. |
/persistent:{yes|no} | Restore the mapping at next logon, or not. The last value used becomes the default. |
/savecred | Store the credential in Credential Manager for reuse. |
/delete | Disconnect. * disconnects everything. |
/home | Connect to the home directory set on the user object. |
* to be prompted, or a credential the machine already has.
Practical examples
1. Map a share and confirm it is really connected
The problem: A script needs Z: to exist and point at the finance share, and “it looks fine in Explorer” is not evidence.
The solution: Map it, then read the status column. net use with no arguments reports each mapping and whether the connection is live.
rem /persistent:no keeps it to this session, which is what a script wants
net use Z: \\SRV-FILE01\Finance /persistent:no
net use
New connections will not be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK Z: \\SRV-FILE01\Finance Microsoft Windows Network
Disconnected Y: \\SRV-OLD01\Archive Microsoft Windows Network
The command completed successfully.
Status OK means the session is established. Disconnected means the letter exists and the server does not answer, which is what a decommissioned file server leaves behind on every workstation that ever mapped it.
2. Different credentials, and error 1219
The problem: You are logged in as yourself, you need a share that only the admin account can read, and the second mapping fails with system error 1219: multiple connections to a server by the same user using more than one user name are not allowed.
The solution: Windows allows one credential per server per session. The existing connection has to go before a different identity can be used against the same server.
rem See every connection to that server, including ones with no drive letter
net use
rem Drop them, including the invisible IPC$ connection Explorer opened
net use \\SRV-FILE01\IPC$ /delete
net use \\SRV-FILE01\Finance /delete
rem Now connect with the other identity; * prompts for the password
net use Z: \\SRV-FILE01\Finance /user:CORP\adm-zaur *
\\SRV-FILE01\Finance and \\srv-file01.corp.local\Finance count as two different servers and can hold two different credentials. It works. It also means two sessions to the same box under two identities, which is confusing to audit and can defeat Kerberos in favour of NTLM.
3. The mapped drive the service cannot see
The problem: A backup script works when you run it, and fails with “the system cannot find the path specified” when the scheduled task runs it. The path is Z:\Backups and Z: is definitely mapped.
The solution: It is not mapped for that task. Drive letters live in a logon session, and the task runs in a different one. There is no way to make a letter visible across sessions reliably, so the answer is to stop using one.
rem Wrong: depends on a drive letter that exists only in an interactive session
robocopy C:\Data Z:\Backups /MIR
rem Right: the UNC path needs no mapping at all
robocopy C:\Data \\SRV-FILE01\Finance\Backups /MIR
If the task genuinely has to map a drive, it must map it itself, in the same script, in its own session.
net use Z: \\SRV-FILE01\Finance /persistent:no
robocopy C:\Data Z:\Backups /MIR
net use Z: /delete
4. The drive that Explorer shows and CMD does not
The problem: Z: is right there in Explorer. Open an elevated Command Prompt, type Z:, and Windows says the device is not ready.
The solution: With UAC enabled you have two linked logon sessions, filtered and elevated, and the mapping was made in the filtered one. Microsoft documents a registry value that makes the symbolic link appear in both.
rem Makes drive mappings visible to both the filtered and elevated session
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v EnableLinkedConnections /t REG_DWORD /d 1 /f
rem A restart is required before it takes effect
EnableLinkedConnections does not reach it. On a server, the cleaner answer remains a UNC path.
5. Clean up, including the credentials
The problem: Mappings from a server that no longer exists reappear at every logon, and one of them still carries a saved password.
The solution: Deleting the mapping does not delete the credential. They are stored separately and both need removing.
rem Remove every mapping, no confirmation prompt
net use * /delete /y
rem Stop new mappings being remembered from now on
net use /persistent:no
rem What credentials are actually stored on this machine
cmdkey /list
rem Remove one of them
cmdkey /delete:SRV-FILE01
net use reports no entries and cmdkey /list no longer shows the server. A mapping that comes back after this is being created by Group Policy or a logon script, not by the machine remembering it.
Hidden gems
/persistent is sticky. The last value you used becomes the default for every later command, and it persists across sessions. One net use X: \\server\share /persistent:yes quietly turns every subsequent mapping into a permanent one. Set it explicitly on every command, or run net use /persistent:no once to reset the default.
Explorer maps things you did not ask for. Browsing to \\SRV-FILE01 opens an IPC$ connection with your current credentials, with no drive letter and no visible sign of it. That invisible connection is what error 1219 is usually complaining about, which is why deleting the mapped drive alone does not fix it.
/savecred is convenience, not security. It writes the credential to Credential Manager, where cmdkey /list shows it and anything running as that user can use it. It is fine for a workstation and wrong for a service account on a shared server.
A Disconnected status is not always a fault. Windows tears the session down when idle and re-establishes it on the next access. A mapping that reads Disconnected and then works when you open it was never broken. One that stays Disconnected after you touch it is.
Two names for one server means two Kerberos tickets. Connecting by short name and by FQDN produces separate service tickets, and if only one of them matches a registered service principal name, one connection uses Kerberos and the other silently falls back to NTLM. klist shows exactly which happened.
PowerShell equivalent
PowerShell has two answers, and they are not interchangeable. New-PSDrive creates a drive inside the PowerShell session; only with -Persist does it become a real Windows mapping visible to other applications.
# -Persist makes it a real drive letter, not just a PowerShell provider drive
New-PSDrive -Name Z -PSProvider FileSystem -Root \\SRV-FILE01\Finance -Persist
# With explicit credentials, prompted rather than typed into the command
New-PSDrive -Name Z -PSProvider FileSystem -Root \\SRV-FILE01\Finance -Credential (Get-Credential) -Persist
# The SMB cmdlets read and write the same mappings net use manages
Get-SmbMapping
New-SmbMapping -LocalPath Z: -RemotePath \\SRV-FILE01\Finance -Persistent $false
Remove-SmbMapping -LocalPath Z: -Force
# Open sessions from this machine to file servers, including the invisible ones
Get-SmbConnection | Select-Object ServerName, ShareName, UserName, Dialect
Get-SmbConnection is the fastest way to see the connection behind error 1219, because it lists the user name in use per server and shows the sessions that have no drive letter.
Where this matters
- Scheduled backups. The single most common cause of a backup that ran green for months and then wrote nothing is a drive letter that stopped existing in the task’s session.
- Application servers. Services do not have logon sessions with drive letters. An application configured with
Z:\datais a time bomb; a UNC path is not. - File server migration. Old mappings survive the decommission and show as Disconnected on every workstation until someone clears them.
- Administrative access. Reaching a share as an admin account from a session logged on as yourself is exactly the 1219 case, and it comes up daily.
- Audit and offboarding.
cmdkey /liston a workstation shows which servers a leaver’s machine still holds credentials for.
Tips and limitations
- Drive letters run from D: to Z:. Mapping over a letter already used by a local disk or a removable device fails, which is why
*is safer inside a script. - Share permissions and NTFS permissions are evaluated separately and the more restrictive wins. A mapping that connects and then refuses to open a folder is an NTFS problem, not a
net useproblem. - Mapping a drive does not survive a reboot unless
/persistent:yeswas in effect, and a persistent mapping to an unavailable server slows down logon while Windows waits for it. - Group Policy Preferences drive maps override what a user does by hand at the next policy refresh. If a mapping keeps coming back or keeps disappearing, check policy before the machine.
- On a domain controller or a server with UAC in admin approval mode, prefer UNC paths everywhere. Drive letters on servers exist mostly to create the problems described above.
Official documentation
Related tools
- ROBOCOPY Command Builder: builds the copy command that should be using a UNC path rather than a mapped letter.
- Port Checker: confirms SMB on port 445 is actually reachable before you blame credentials.
Related guides
- schtasks in Windows: create, query and audit scheduled tasks from CMD: the session a scheduled task actually runs in, and why it cannot see your drive.
- klist in Windows: read and clear the Kerberos ticket cache: which authentication a connection really used.
- ICACLS command in Windows: the NTFS half of a share that connects but will not open.
- How to backup files with ROBOCOPY: the job that most often breaks on a missing drive letter.