How to Map Network Drives Using PowerShell

In years past, automatic map network drives required the use of primitive batch files, luckily for us you can now do it through PowerShell.

By Tim TrottWindows Tips and Tricks • July 8, 2017
How to Map Network Drives Using PowerShell

Using a mapped network drive, you can quickly access files and folders on a shared network as if they were on your local workstation.

Before the PowerShell era, we could map network drives using a batch file that contained a net use command:

net use M: \\nasserver\Share /Persistent:Yes

To map network drives in PowerShell, open up your favourite terminal application and enter the following command to map network drives.

powershell
New-PSDrive -Name "M" -PSProvider FileSystem -Root "\\nasserver\share" -Persist

You can roll this into a PowerShell script, which you can double-click on the desktop or add to startup.

If you want to map a network drive manually, open File Explorer and right-click "This PC" on the left-hand side of the window. Select "Map Network Drive, " enter the address, select the letter you want to map it to, and then click Finish. You can also check the "Reconnect at Login" box to keep the drive visible after rebooting. Otherwise, you will have to map it again.

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

My website and its content are free to use without the clutter of adverts, popups, marketing messages or anything else like that. If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

There are no comments yet. Why not get the discussion started?

New comments for this post are currently closed.