Skip to content
Follow
Windows

How to Map Network Drives with PowerShell in Windows 11

Richard
Written by
Richard
Jul 25, 2023 Updated Jun 19, 2026 2 min read
How to Lock and Unlock OneDrive Personal Vault in Windows 11
How to Lock and Unlock OneDrive Personal Vault in Windows 11

You map a network drive in Windows 11 using PowerShell with commands like `New-PSDrive` to create persistent connections to network shares.

PowerShell is Windows’ powerful command-line shell and scripting language, perfect for automating system administration. Mapping a network drive lets you treat shared folders on other computers like local drives.

This makes accessing frequently used network resources much faster. You can assign specific drive letters, for example, mapping ‘Z:’ to a network path.

⚡ Quick Answer

Use the New-SmbMapping cmdlet in PowerShell to map network drives persistently. Open PowerShell, then run New-SmbMapping -LocalPath “Z:” -RemotePath “\ServerNameShare” -Persistent $true, replacing “Z:” and the server path with your desired drive letter and network share.

Why Use PowerShell to Map Network Drives?

Why map network drives with PowerShell? It’s faster than clicking through menus, and it lets you automate connections for many computers at once. What happens when done? You gain a persistent network location that acts like a local folder, making file access seamless.

New-PSDrive vs New-SmbMapping

New-PSDrive vs. New-SmbMapping: It’s important to know the difference. New-PSDrive creates a drive that’s only available during your current session and might not appear in File Explorer. For persistent mapped drives that appear in Windows, use New-SmbMapping. You can find more details in the official Microsoft documentation.

UAC and Administrative Context

Mapped network drives might not show up for your regular user account if you mapped them using PowerShell as an administrator, due to Windows’ User Account Control (UAC).

💻Code
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLinkedConnections -Value 1 -PropertyType DWord -Force

How to Map a Network Drive Silently

To map a drive without pop-ups, use the -SkipCredentialCheck or pre-stored credentials. You can also use Test-NetConnection to verify the server is reachable before mapping. This prevents errors during silent execution.

💻Code
if (Test-NetConnection -ComputerName "ServerName" -Port 445) { New-SmbMapping -LocalPath "Z:" -RemotePath "\\ServerName\Share" -Persistent $true }

Step 1Open PowerShell

Click the Start Menu and search for PowerShell. Then, select and open the app. Note: Do not run as administrator unless you need to change system settings.

Step 2Map the Drive

Use the New-SmbMapping command for a persistent network location that shows in File Explorer.

💻Code
New-SmbMapping -LocalPath "Z:" -RemotePath "\\ServerName\Share" -Persistent $true

Step 3Check Existing Connections

To see your current network drives, use the following command:

PowerShell
Get-SmbMapping

Unmap or Disconnect Network Drives

To remove a specific drive, use the Remove-SmbMapping command.

💻Code
Remove-SmbMapping -LocalPath "Z:" -Force

Summary

Mapping network drives with PowerShell is a handy way to manage shared folders and set them up to appear automatically.

Why does my PowerShell mapped drive not appear in File Explorer?

Your PowerShell mapped drive might not show up in File Explorer because commands like New-PSDrive often only work within that specific PowerShell session, or if you ran PowerShell as an administrator.

Was this guide helpful?

Tags: #Windows 11
Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

2633 articles → Twitter

📚 Related Tutorials

How to Map Local Folders as Drives in Windows 11
Windows How to Map Local Folders as Drives in Windows 11
How to Change PowerShell Execution Policies in Windows 11
Windows How to Change PowerShell Execution Policies in Windows 11
How to Use Access Keys in Windows 11 File Explorer
Windows How to Use Access Keys in Windows 11 File Explorer
How to Change File Explorer Layout in Windows 11
Windows How to Change File Explorer Layout in Windows 11

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *