Using the GUI
- Select the Windows Start Icon > Computer.
- In the top menu of Windows Explorer, select Map network drive.
- In the Map Network Drive dialog box, type \\fs.example.com\share and select Finish. Replace fs.example.com with the domain name or IP address of the share.
Using the command line
net use command can be used to show if there are any network drives already mapped.
C:\Users\john.doe>net use
Status Local Remote Network
-------------------------------------------------------------------------------
OK X: \\server1.example.com\share Microsoft Windows Network
OK Y: \\server2.example.com\share Microsoft Windows Network
OK Z: \\server3.example.com\share Microsoft Windows Network
The net use <drive letter>: <UNC path> command can be used to map a network drive.
- Note: the /delete option can be used to disconnect a mapped network drive (example: net use m: /delete)
C:\Users\john.doe>net use S: \\server4.example.com\share
Using PowerShell
New-PSDrive
# Add a network drive
$pass="Your Password"|ConvertTo-SecureString -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PsCredential('Your Username',$pass)
New-PSDrive -Name X -PSProvider FileSystem -Root \\fs.example.com\share -Credential $Cred -Persist
# List the network drives
Get-PSDrive
# Remove the network drives
Remove-PSDrive -Name X -PSProvider FileSystem
net use
$FS2 = "\\fs.example.com\share"
$username = "Your Username"
$password = "Your Password"
net use $FS2 $password /USER:$username
On Boot
To have a network drive mapped when Windows is restarted, you can create a batch file, such as map.bat at C:\Users\your_username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup, and the network drive will be mapped on boot.
net use z: \\fs.example.com\share /persistent:yes
Username / Password
When mapping the network drive, there may be a prompt to enter a username and password.
If the Samba is being used for the share, on the Samba server, use the smbpasswd command to add a users password to the SMB database. You can now connect to the Samba share using the username and password.
[root@server1 ~]# smbpasswd -a jeremy
New SMB password: ********
Retype new SMB password: ********
Did you find this article helpful?
If so, consider buying me a coffee over at