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 Trott | Windows Tips and Tricks | July 8, 2017

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

Before the PowerShell era, we could map networks 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 wish.

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

Was this article helpful to you?
 

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

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?

We respect your privacy, and will not make your email public. Learn how your comment data is processed.