How to Map Network Drives with PowerShell in Windows 11
You map a network drive in Windows 11 using PowerShell by employing cmdlets like New-PSDrive to establish persistent connections to network shares.
PowerShell is a powerful command-line shell and scripting language built into Windows, designed to help you automate system administration tasks. Mapping a network drive allows you to access shared folders on other computers as if they were local drives on your system.
This process is particularly useful for streamlining access to frequently used network resources, eliminating the need to manually browse to them each time. You can even map drives using specific drive letters, for instance, assigning the ‘Z:’ drive to a particular network path.
Why Use PowerShell to Map Network Drives?
Why map network drives with PowerShell? It is faster than clicking through menus and allows you to 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
It is important to know the difference. New-PSDrive creates a session-specific drive that often does not appear in File Explorer. For persistent mapped drives that show up in Windows, use New-SmbMapping. You can find more details in the official Microsoft documentation.
UAC and Administrative Context
Windows uses User Account Control (UAC) to separate standard and admin tasks. If you run PowerShell as an administrator, your mapped drives will not be visible to your standard user account. To fix this, you can enable linked connections. (Requires Admin Privileges)
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.
if (Test-NetConnection -ComputerName "ServerName" -Port 445) { New-SmbMapping -LocalPath "Z:" -RemotePath "\\ServerName\Share" -Persistent $true }Step 1Open PowerShell
Click on the Start Menu and search for PowerShell. 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.
New-SmbMapping -LocalPath "Z:" -RemotePath "\\ServerName\Share" -Persistent $true
Step 3Check Existing Connections
To see your current network drives, use the following command:
Get-SmbMapping
Unmap or Disconnect Network Drives
To remove a specific drive, use the Remove-SmbMapping command.
Remove-SmbMapping -LocalPath "Z:" -Force
Summary
Why use PowerShell? It provides a powerful way to manage network shares and automate drive assignments. What happens when you map a drive? You create a persistent link to a remote folder, allowing you to access files as if they were on your local machine. What happens when you unmap a drive? The connection is terminated, and the drive letter is removed from your system.
Why does my PowerShell mapped drive not appear in File Explorer?
If you use New-PSDrive, the mapping is often restricted to the current PowerShell session. Furthermore, if you run PowerShell as an administrator, the drive is created in a different security context than your user account. Use New-SmbMapping in a standard user window to ensure the drive appears in File Explorer.
Was this guide helpful?
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.
No comments yet — be the first to share your thoughts!