How to Map Network Drives Using PowerShellIn years past, automatic map network drives required the use of primitive batch files, luckily for us you can now do it through 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.
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.