Windows: Add An Network Drive from Command Line

Smart Panda - Network DriveWindows Network Drive Mapping:

Every once and awhile you will be working away and with all the new protections in windows, you will have to run something as administrator. This is fine however, occassional that program you are running will require that you access a network drive. However, sometimes, you may not be able to access that network drive because of the privileges.  If the network drive is mapped as you the user, the administrator will not see the mapped drive that you have.

A nice and quick way to solve this problem is to map a network drive as the administrator.  To do this run the command line program (cmd) as administrator, which will give you the nice old fashion “DOS” window.  From here simply execute the command:

net use

This will list all the network drives that are mapped for the administrative user.  If you don’t see the drive you want add it:

net use {drive-letter} {unc-path}

so if you wanted the drive \\myserver\myshare to be mapped to the z: drive enter:

net use z: \\myserver\myshare

Smart Panda - IdeaIf you want to get fancy, you can add credentials and persistence with the following command:

net use {drive-letter} {unc-path} /user {user-name} {password} /P:Yes