Free tools Windows power users keep installed
One-click scans. No signup required.
How difficult is it to map a drive in PowerShell? It is as easy as saying “PowerShell”!
Method 1: Map a Network Share in PowerShell
The most common task for SysAdmins is to map network drives. There are multiple methods to map network drives.
However, like most Windows tasks, you can map a network share with PowerShell.
To map a network share, run a command similar to the one below:
#1 Best Overall
- Entry-level NAS Personal Storage:UGREEN NAS DH2300 is your first and best NAS made easy. It is designed for beginners who want a simple, private way to store videos, photos and personal files, which is intuitive for users moving from cloud storage or external drives and move away from scattered date across devices. This entry-level NAS 2-bay perfect for personal entertainment, photo storage, and easy data backup (doesn't support Docker or virtual machines).
- Set Your Devices Free, Expand Your Digital World: This unified storage hub supports massive capacity up to 64TB.*Storage drives not included. Stop Deleting, Start Storing. You can store 22 million 3MB images, or 2 million 30MB songs, or 43K 1.5GB movies or 67 million 1MB documents! UGREEN NAS is a better way to free up storage across all your devices such as phones, computers, tablets and also does automatic backups across devices regardless of the operating system—Window, iOS, Android or macOS.
- The Smarter Long-term Way to Store: Unlike cloud storage with recurring monthly fees, a UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $459.98 for a NAS, while for cloud storage, you need to pay $719.88 per year, $2,159.64 for 3 years, $3,599.40 for 5 years. You will save $6,738.82 over 10 years with UGREEN NAS! *NAS cost based on DH2300 + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
- Blazing Speed, Minimal Power: Equipped with a high-performance processor, 1GbE port, and 4GB RAM on Board, this NAS handles multiple tasks with ease. File transfers reach up to 125MB/s—a 1GB file takes only 8 seconds. Don't let slow clouds hold you back; they often need over 100 seconds for the same task. The difference is clear.
- Let AI Better Organize Your Memories: UGREEN NAS uses AI to tag faces, locations, texts, and objects—so you can effortlessly find any photo by searching for who or what's in it in seconds. It also automatically finds and deletes similar or duplicate photo, backs up live photos and allows you to share them with your friends or family with just one tap. Everything stays effortlessly organized, powered by intelligent tagging and recognition.
New-PSDrive -Name "N" -PSProvider "FileSystem" -Root "\\DESKTOP-SIAQMO1\Log Files"
The Name is like the drive letter. Change this to whatever you want. The name can also be a word.
You do not need to change the PSProvider – FileSystem is the PSProvider for folders. However, you have to change the Root – path to your network share.
Once you have modified the command to meet your needs, to map the network drive, enter the command in PowerShell and press the enter key on your keyboard. The drive will be mapped in the current PowerShell session.
It will also display the details of the mapped drive.

In the examples above, the network drives mapped by PowerShell are NOT persistent. The implication is that if I close my current PowerShell session, the mapping will be lost.
To map a persistent network share with PowerShell, add the Persist parameter. Here is the modified command that will map a shared network drive as a persistent drive:
New-PSDrive -Name "N" -PSProvider "FileSystem" -Root "\\DESKTOP-SIAQMO1\Log Files" -Persist
Moreover, the New-PSDrive command has another parameter, Credential that allows you to specify a user name and password to access a network share you want to map.
You will need to add the Credential parameter if the account you are currently logged in with does not have access to the drive you want to map. To specify a credential, use the DomainName\UserName format.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Finally, here is the modified New-PSDrive command that will map a persistent network share with a specified credential:
Rank #2
- 【Advanced Home Data & Media Hub】For advanced home users who need phone backup, file storage, and centralized data management. Centralize family photos, 4K videos, movies, computer backups, and personal files in one place while running multiple apps for home entertainment and everyday data management. Suitable for households with growing digital libraries and multiple NAS use cases.
- 【Built for Creators, Media Servers & Advanced Apps】Powered by the Intel N100 Quad-Core CPU, 8GB DDR5 RAM, 2.5GbE networking, and dual M.2 NVMe slots, DXP2800 handles large files and heavier workloads with ease. Run Docker, virtual machines, and media server applications compatible with Plex—ideal for content creators, tech enthusiasts, and advanced home users managing 4K videos, RAW photos, personal media libraries, and multiple NAS apps.
- 【Up to 80TB for Growing Digital Libraries】 Supports up to 80TB of storage using two HDD bays and two M.2 NVMe SSD slots for family photos, movies, RAW photos, 4K videos, work files, and device backups. AI photo management supports recognition of people, objects, scenes, and locations, album organization, and duplicate photo detection. HDDs and SSDs are not included.
- 【AI-powered Home Surveillance】Turn DXP2800 into a centralized home surveillance hub by connecting compatible network cameras and storing recordings locally on your NAS. AI-powered features include Face Recognition, People Detection, and Pet Detection, helping advanced home users review important events more efficiently while managing home surveillance and personal data in one place.
- 【One data Center Across Your Devices】Keep files from desktops, laptops, phones, tablets, and other devices together instead of scattered across cloud accounts and external drives. Access, back up, organize, and share data across Windows, macOS, Android, iOS, web browsers, and compatible smart TVs—ideal for creators and advanced home users working across multiple devices.
New-PSDrive -Name "N" -PSProvider "FileSystem" -Root "\\DESKTOP-SIAQMO1\Log Files" -Persist Credential DomainName\UserName
If you press enter key to execute the command, PowerShell will request the password for the UserName.
Method 2: Map a Local Folder as a Drive in PowerShell
When you map a network drive, you connect a shared folder on a remote computer to your local computer. However, you can also map a folder on your PC as a network drive.
The process for mapping a network drive is the same as mapping a local folder as a drive. To map a local folder as a drive, modify the Root parameter of the New-PSDrive command.
Instead of specifying the path to a network share in the Root parameter – you specify a path to a local folder. In the example, I want to map my Document folder to a drive called Document.
Here is the modified command:
New-PSDrive -Name "Document" -PSProvider "FileSystem" -Root "C:\Users\victo\Documents"
Here is the result of the command.

Method 3: Map a Drive Using PowerShell Hashtable
In the first two examples above, we mapped network drives with PowerShell by entering the parameters of the New-PSDrive command directly in the command.
However, in some scripting situations, you may decide to create a hashtable that defines the parameters. Then, use the hashtable in the New-PSDrive command.
This method is a 2-step process. The first step is to create the hashtable. Then, in the last step you run the New-PSDrive command.
Before I proceed with the example in this section, refer to the last command.
New-PSDrive -Name "Document" -PSProvider "FileSystem" -Root "C:\Users\victo\Documents"
In this example, I will add the Name, PSProvider, and Root parameters in a hashtable, $documents. Here is a sample hashtable with these details:
Rank #3
- Entry-level NAS Home Storage: The UGREEN NAS DH4300 Plus is an entry-level 4-bay NAS that's ideal for home media and vast private storage you can access from anywhere and also supports Docker but not virtual machines. You can record, store, share happy moment with your families and friends, which is intuitive for users moving from cloud storage, or external drives to create your own private cloud, access files from any device.
- Smart Photo Backup & AI Album: Automatically back up photos and videos from your phone in real time and keep growing family memories organized with AI-powered photo albums. Semantic search, custom learning, and recognition of people, objects, pets, and similar photos help you quickly find the moments you want. Duplicate photo removal also helps keep your library organized—ideal for families and users with large photo collections.
- User-Friendly App & Easy Setup: Connect quickly via NFC, set up simply and share files fast on Windows, macOS, Android, iOS, web browsers, and smart TVs. You can access data remotely from any of your mixed devices. What's more, UGREEN NAS enclosure comes with beginner-friendly user manual and video instructions to ensure you can easily take full advantage of its features.
- More Cost-effective Storage Solution: Unlike cloud storage with recurring monthly fees, A UGREEN NAS enclosure requires only a one-time purchase for long-term use. For example, you only need to pay $629.99 for a NAS, while for cloud storage, you need to pay $719.88 per year, $1,439.76 for 2 years, $2,159.64 for 3 years, $7,198.80 for 10 years. You will save $6,568.81 over 10 years with UGREEN NAS! *NAS cost based on DH4300 Plus + 12TB HDD; cloud cost based on 12TB plan (e.g. $59.99/month).
- Your Data, You Control:No third-party clouds, no hidden access, UGREEN NAS provides a more secure and private data storage solution. It stores data locally on your private hard drives and does automatic backups. Thus, you can keep full control over it. The advanced encryption is TRUSTe certified in the United States and is awarded the first (and only) ETSI EN 303 645 certification mark for NAS products by TÜV SÜD Group.
$parameters = @{
Name = "Document"
PSProvider = "FileSystem"
Root = "C:\Users\victo\Documents"
}
Copy it to a new PowerShell ISE document (modify the values as required). Then, beneath the hashtable, add the New-PSDrive command as shown below:
New-PSDrive $parameters
The full command should be as shown below:
$parameters = @{
Name = "Document"
PSProvider = "FileSystem"
Root = "C:\Users\victo\Documents"
}
New-PSDrive @parameters
Finally, to execute the command, click the Run Script icon (highlighted in the screenshot below). The script will run and display the results of the mapped drive at the bottom of PowerShell ISE.

Method 4: Map a Drive for a Registry Key
Before you read this section, I strongly recommend that you read our article on How to Use PowerShell to Read Registry Value.
So far, we have covered steps to map folders as drives with PowerShell. However, you can also map a registry key as a drive.
The command to map a registry key as a drive with PowerShell is similar to the command used to map folders. The only difference is that instead of specifying PSProvider as “FileSystem”, you specify it as “Registry”.
Additionally, instead of specifying the Root as a folder or share path, you will specify a path to a Windows registry key.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Based on the above information, to map the registry key HKEY_CURRENT_USER\Control Panel, I will use the command below:
New-PSDrive -Name "CPRegistry" -PSProvider "Registry" -Root "HKCU:\Control Panel"
When you run the command, PowerShell will map the registry path with the specified parameters – then, display the details of the mapped drive.

Method 5: Map a Network Drive with the MapNetworkDrive Function
All the examples I have given so far use the New-PSDrive Cmdlet to map a drive in PowerShell. There are two limitations to the New-PSDrive Cmdlet methods:
Rank #4
- Value NAS with RAID for centralized storage and backup for all your devices. Check out the LS 700 for enhanced features, cloud capabilities, macOS 26, and up to 7x faster performance than the LS 200.
- Connect the LinkStation to your router and enjoy shared network storage for your devices. The NAS is compatible with Windows and macOS*, and Buffalo's US-based support is on-hand 24/7 for installation walkthroughs. *Only for macOS 15 (Sequoia) and earlier. For macOS 26, check out our LS 700 series.
- Subscription-Free Personal Cloud – Store, back up, and manage all your videos, music, and photos and access them anytime without paying any monthly fees.
- Storage Purpose-Built for Data Security – A NAS designed to keep your data safe, the LS200 features a closed system to reduce vulnerabilities from 3rd party apps and SSL encryption for secure file transfers.
- Back Up Multiple Computers & Devices – NAS Navigator management utility and PC backup software included. NAS Navigator 2 for macOS 15 and earlier. You can set up automated backups of data on your computers.
- The New-PSDrive Cmdlet is available from PowerShell version 3.0. So, in the rare instance that you still use PowerShell version 2.0, you will not be able to use any of the methods discussed above
- When you map a drive with New-PSDrive Cmdlet, the mapped drive is only available in PowerShell. The drive will not be available in File Explorer
If you want to overcome these two limitations, use the method discussed in this section – to map a drive in PowerShell. To make it easy to understand, this section is divided into two sub-sections.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchCreate a Wscript.Network ComObject
The first step to use this method to map a drive in PowerShell is to create a Wscript.Network ComObject – then save it in a variable. Here is the command that does the job:
$WscriptNetwork = New-Object -ComObject "Wscript.Network"
Before you proceed, open a PowerShell prompt and run the command. The ComObject will be created.
In the next section, we map network drive

Map Network Drive with the MapNetworkDrive Function
Now that you have created a Wscript.Network ComObject, you can use its MapNetworkDrive function to map a network drive. Here are the commands:
$WscriptNetwork.MapNetworkDrive("K:", "\\DESKTOP-SIAQMO1\Log Files")
$WscriptNetwork.MapNetworkDrive("K:", "\\DESKTOP-SIAQMO1\Log Files", $True)
The first command maps the network share “Log Files” on DESKTOP-SIAQMO1 to drive K. However, the mapping is not persistent.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsOn the contrary, the second command maps the same share but makes it persistent. What makes the mapping persistent is the $True parameter of the MapNetworkDrive function.
Moving on, I will run the last command. Like the first command, the first command does not display any results.

However, there are two methods you can confirm that the drive is mapped.
Method 1: Run the Set-Location command below to point to the drive letter – in my example, K.
Recommended Free Tools
Best Value
- Your Personal Streaming Server - Build your own Netflix-style media library and stream 4K movies, shows and photos to any device without monthly fees
- Create Your Own Cloud - Store your entire photo, video and music collection; access from anywhere with fast 282 MB/s transfer speeds
- Creator-Grade Backup Solution - Protect your irreplaceable content with automated backups to cloud services, external drives and remote NAS
- Multi-Layered Data Protection - Combine RAID redundancy, automated backups and snapshot technology to prevent data loss from any cause
- Smart Home Surveillance - Support up to 30 IP cameras with AI detection, instant alerts and secure remote monitoring
Set-Location P:\
Finally, if you want to list the content of the folder, run the Get-Childitem command.
Get-Childitem
I have displayed the output of the Get-Childitem command and the content of the folder in File Explorer in the screenshot below.

Method 2: Another method to confirm that the network share was mapped is to open “This PC” in File Explorer.

There you have it – 5 methods to map a drive in PowerShell!
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →I hope you found the methods to map drive with Windows PowerShell discussed in this guide helpful.
If you found it helpful, kindly share your experience with our community using the comments form below.
Alternatively, simply respond to the “Was this page helpful” question below and provide us with your feedback.
Finally, for more PowerShell tech Itechguides, visit our Windows PowerShell How-To guide page. You may also find our Work from Home page very helpful.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.


Hi Victor,
Mike is correct. Using New-PSDrive with the combination of both [-Persist -Scope Global] makes the mapped drive available to File Explorer. It works for PSv3+ (I tried on 5.1), but with older versions like v2 (not sure how far back), we have to resort to your $WscriptNetwork.MapNetworkDrive method.
{google: powershell “New-PSDrive” “-scope global”}
I hope that helps!
-James
“When you map a drive with New-PSDrive Cmdlet, the mapped drive is only available in PowerShell. The drive will not be available in File Explorer”
This is not true. You can make the drive available to File Explorer simply by adding -Scope Global. If you’re mapping from a script, you also need to dot-source the script.
Hello Mike,
Thank you for your comment and feedback. Unfortunately, I ran New-PSDrive with -Scope Global but the mapped drive did not appear on File Explorer.
I’ll appreciate it if you can share the exact command and maybe screenshots for our readers.
Thanks again.