guide · static export
PC

Map a Network Drive That Reconnects After Every Reboot

Store the credentials in the right place, pin the letter, and fix the two errors that keep a mapped drive from surviving a restart.

by@guidox updated:10/31/26 time:10 min level:Beginner tested on:Windows 11 24H2 works on:Windows 10, Windows 11 tools:Command Prompt, Access to the share
TL;DR

Map with **net use** `net use Z: \\NAS\media /user:NAS\media /persistent:yes`, store the password with `cmdkey`, and confirm the result with `Get-SmbMapping` after a reboot.

Before you start

Requirements

  • A share on the network
  • Admin rights for the credential
  • Ten minutes
Step by step

Instructions

01

Prove the share answers

Test the port, not the ping. Windows blocks ICMP by default, so a silent ping says nothing about whether SMB is reachable.

Test-NetConnection nas -Port 445
tipTcpTestSucceeded True is the only line that matters. False points at the firewall, the server or the name.
02

Map with the credentials in one command

The user switch keeps the identity for this mapping only, and persistent writes the entry into your profile so it comes back at logon.

net use Z: \\NAS\media /user:NAS\media /persistent:yes
⚠ warningThe password prompt shows nothing while you type. A typo produces error 1326 and a broken mapping that has to be deleted first.
03

Store the password for the server

cmdkey keeps the credential in the Windows vault, which is what the reconnect uses. Without it the mapping exists but asks for a password at every logon.

cmdkey /add:NAS /user:NAS\media /pass
tipThe entry is tied to the exact server name. If you mapped by IP address, add a second entry for the IP or the prompt returns.
04

Confirm the mapping is persistent

Get-SmbMapping lists what the session really has, including mappings Explorer created behind your back.

Get-SmbMapping | Select-Object LocalPath,RemotePath,Status
05

Handle the red cross after sleep

A disconnected mapping after resume is normal and reconnects on first access. If it stays red, delete it and map again; the repair option in Explorer keeps the stale credential.

net use Z: /delete
06

Make elevated apps see the drive

Explorer runs with a normal token, so an administrator console maps into a separate session and shows no drive. Linked connections share one credential set between both.

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLinkedConnections /t REG_DWORD /d 1 /f
⚠ warningA reboot is required, and a domain policy can overwrite the value at the next logon.
Troubleshooting

Common issues

0x80070035 the network path was not found

Name resolution or a disabled SMB service. Test the IP address to separate DNS from the share itself.

Error 1219 multiple connections to a server

One server, two identities. Delete every mapping and vault entry for that host, then connect once with the account you want.

The drive is gone after a reboot

It was mapped without /persistent:yes, or an elevated shell created it. Remap from a normal Explorer window.

Files open read-only

Share and NTFS permissions both apply and the tighter one wins. Check the security tab, not only the sharing tab.

FAQ

Frequently asked

Can I map the same share twice with different accounts?

No. Windows allows one identity per server within a session.

Does this work over a VPN?

Yes, but map after the tunnel is up. A mapping created before the route exists fails at logon.

How to undo this

net use Z: /delete removes the mapping and cmdkey /delete:NAS removes the stored credential. The EnableLinkedConnections value can be deleted or set back to 0.

Changelog · 1 entry
  1. 2026-10-31
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress