Mapping a network drive assigns a drive letter to a shared folder on another computer or server. You can create the mapping using Command Prompt or PowerShell.

Before you start

You need a reachable Windows-compatible network share, permission to access it and an unused drive letter. Replace ServerName, SharedFolder, Domain and Username in the examples with your own values. A website URL or hosting account is not itself a network share.

Open the terminal as the Windows user who needs the drive. Mappings created in an elevated session or under another user’s credentials may not appear in your usual File Explorer session.

Map a drive using Command Prompt

Press Windows + R, enter cmd and press Enter. Run:

net use Z: "\\ServerName\SharedFolder" * /user:Domain\Username /persistent:yes

The asterisk prompts for the share password without including it in the command. Use ServerName\Username for an account local to the remote server, where appropriate.

The /persistent:yes option restores the mapping at subsequent sign-ins. The share must still be reachable and authentication must succeed. Check the command’s result, then look for Z: under This PC in File Explorer.

Map a drive using PowerShell

Open PowerShell as your usual Windows user. Request the share credentials, then create the mapping:

$credential = Get-Credential
New-PSDrive -Name "Z" -PSProvider FileSystem -Root "\\ServerName\SharedFolder" -Credential $credential -Persist -Scope Global

Enter an account that has access to the share when prompted. -Persist creates a Windows mapped drive. -Scope Global also prevents a mapping created inside a script from being removed when that script’s scope ends.

Check the mapping:

Get-PSDrive -Name "Z"

Disconnect a mapped drive

Close files that are open on the drive. In Command Prompt, run:

net use Z: /delete

Alternatively, in PowerShell, run:

Remove-PSDrive -Name "Z"

Disconnecting the drive removes the mapping; it does not delete the shared folder or its files.

If the mapping fails

Check the share path, network or VPN connection, permissions and available drive letters. If the drive appears in one terminal but not in File Explorer, check whether you created it in a different user or elevated session.