Home Networking

How to Reconnect a Mapped Drive Automatically on Startup?

Short answer: map the share as a persistent drive and save the share credentials so Windows can reuse them at sign-in. If the network or authentication isn't ready, add a per-user scheduled task with a short delay to run a reconnect command after you log in.

7 min read

Short answer: map the share as a persistent drive and save the share credentials so Windows can reuse them at sign-in; if the network or authentication isn't ready when you sign in, add a short-delay per-user scheduled task that runs a reconnect command. These steps work on current Windows builds in 2026, though exact UI labels and corporate policies can vary — check your organization's guidance or the current Microsoft docs if anything below doesn't match your system. Below are the prerequisites, explicit ordered steps to create a persistent mapping (File Explorer and command line), how to save credentials securely, how to add a delayed scheduled task if the mapping fails at sign-in, and simple checks to verify the mapping after restart.

What you need before you start (prerequisites)

  • The UNC path for the share you want to map (example: \\fileserver01.example.com\ProjectShare).
  • An account that has access to that share (user name and password) or a domain account that signs you in.
  • Knowledge whether you sign in with a local account, Active Directory, Azure AD, or a hybrid account; this affects whether Windows can cache and apply saved credentials at sign-in.
  • Permission from your IT or security team if this is a corporate-managed workstation; some organizations block saved credentials, persistent mappings, or scheduled tasks by policy.
  • Administrator rights only if you plan to create a system-level scheduled task that runs when no user is logged on. You do not need admin rights to create a persistent mapping for your own account.

Step-by-step: Map the drive so Windows reconnects it at sign-in

Method A — File Explorer (easiest for most users)

  1. Open File Explorer.
  1. Right-click "This PC" and choose "Map network drive...".
  1. Choose a drive letter and enter the folder as the UNC path.
  1. Check "Reconnect at sign-in".
  1. If the share requires different credentials, check "Connect using different credentials" and supply the share account when prompted. Expected result: Windows creates a persistent mapping that appears after you sign out and sign in.

Method B — Command line (repeatable and scriptable)

  1. Open Command Prompt (no Administrator required for a per-user mapping).
  1. Run a net use command with /persistent:yes. If you must specify a user name, include /user: but avoid putting a password on the command line.
Command Prompt
net use Z: \\\\fileserver01.example.com\\ProjectShare /user:EXAMPLE\\yourusername /persistent:yes

Expected result: net use creates a persistent mapping stored for your account. If credentials are required and not already saved, Windows will prompt on first connect.

Save credentials before mapping (recommended when the share requires a different account)

  1. Open Credential Manager (search "Credential Manager" in Start).
  1. Choose "Windows Credentials" and add a new Windows credential for the server and account used to access the share. Expected result: Windows will use this stored credential when establishing the persistent mapping at sign-in.

If the drive still disappears: create a per-user delayed scheduled task to reconnect

When to use a scheduled task: use this only if persistent mappings intermittently fail because the network, VPN, or domain services are not ready when Windows restores mappings at sign-in.

Steps to create a simple per-user delayed reconnect task (Task Scheduler GUI)

  1. Open Task Scheduler.
  1. Create a new task and set "Security options" to "Run only when user is logged on".
  1. On the Triggers tab, add a trigger "At log on" and set a delay such as 30 seconds.
  1. On the Actions tab, add an action to start a program: cmd.exe with arguments /c followed by your net use command.
  1. Save the task. Expected result: the task runs after you sign in, waits the delay, and runs the net use command to re-establish the mapping.

Example action arguments field to paste into Task Scheduler:

Command Prompt
/c net use Z: \\\\fileserver01.example.com\\ProjectShare /persistent:yes

Create the task from the command line (per-user, no password stored)

  1. Open Command Prompt as the same user who will be logged on.
  1. Run the schtasks command to create an on-logon task. Expected result: the task is created under your user account and will run at logon without embedding a password.
Command Prompt
schtasks /create /sc onlogon /tn "ReconnectMappedDrive" /tr "cmd /c net use Z: \\\\fileserver01.example.com\\ProjectShare /persistent:yes" /rl LIMITED /f

If your environment requires a system-level task or storing credentials to run when no user is logged on, follow your IT team's approved process and accept the higher security risk.

Common causes and cautions if reconnection fails

  • Wrong credentials: verify the account by connecting to the share with an interactive net use or by opening the UNC path in File Explorer.
  • Network not ready at sign-in: use the delayed scheduled task described above or increase the delay.
  • Drive letter conflict: Windows won't map a drive letter already in use. Use net use to view and remove old mappings.
  • Group Policy or corporate restrictions: managed environments can disable persistent mappings or block credential storage. Check with IT and review applied policies.
  • Cached credentials disabled: if credential caching is disabled for your device or account, Windows won't store share credentials and persistent mapping will fail.
  • Cloud sign-in or conditional access: Azure AD sign-in timing and conditional access policies can affect credential availability at logon; follow your organization's guidance.
  • Using /savecred: this stores credentials and requires administrative action; it's generally discouraged and can be disabled by policy.

Concise checks and fixes:

  • Check current mappings: run net use in Command Prompt.
Command Prompt
net use
  • Remove a stale mapping:
Command Prompt
net use Z: /delete
  • Test UNC access directly by typing \\fileserver01.example.com\ProjectShare into File Explorer's address bar.
  • Verify credentials in Windows Credential Manager and correct or remove any wrong entries.
  • If Group Policy blocks persistence, ask IT for an approved method such as an official login script, SCCM-deployed task, or managed startup action.

How to verify it worked and what the final result looks like

  1. Sign in and open File Explorer. Confirm the mapped drive letter appears under "This PC" and that double-clicking it shows the share contents. Expected result: the mapped drive is listed and accessible.
  1. Run net use in Command Prompt and confirm the expected mapping entry appears.
Command Prompt
net use

Expected output example (the exact text varies by Windows build):

Expected output
Status       Local     Remote                    Network
-------------------------------------------------------------------------------
OK           Z:        \\fileserver01.example.com\ProjectShare  Microsoft Windows Network
The command completed successfully.
  1. Restart the computer and sign in again. The mapped drive should appear without manual remapping. If you used a delayed scheduled task, wait the delay you configured and then re-check.

If the drive shows as "Unavailable" or access fails, re-check credentials, network connectivity (VPN), and domain controller availability. If policies prevent persistent mappings, request an IT-approved solution.

Frequently Asked Questions

Can I store the share password in the `net use` command so the task reconnects without prompting?

Technically you can append a password to `net use`, but that exposes the password in task definitions and command history. Use Windows Credential Manager to store the share credentials for your account, or use a per-user scheduled task that runs only when you are logged on so it uses the interactive session's credential context. If your organization requires a different approach, follow IT-approved procedures.