Map a Network Drive

There are many different methods for mapping a drive. This article details how to map a network drive upon login using a registry entry and a batch file, without needing to store a password in plain text.

This method assumes the file server is set up with permissions using the method described in Manage NFS in JumpCloud.


This method will create a G:\ drive upon user login, put the login script in c:\scripts\ and name the registry key mapdrive. These are all variables that can easily be changed to accommodate different use cases and environments.

  1. Create a batch file containing the following, replacing the net use path as necessary:

echo off
reg add hklm\software\microsoft\windows\currentversion\run /v mapdrive /t REG_SZ /d c:\scripts\netuse.bat /fmkdir c:\scripts
echo net use * /delete /yes > c:\scripts\netuse.bat
echo net use g: "\\fileserver\share" /user:%%username%% >> c:\scripts\netuse.bat

  1. Create a command in the JumpCloud Admin Portal, making sure the Windows PowerShell option is not selected. For this example, name it setnetdrive.bat.

cmd.exe /c c:\windows\temp\setnetdrive.bat

  1. Go to the file upload section and upload your setnetdrive.bat to c:\windows\temp and run it on any target system where drives need to be mapped.  
Back to Top

Still Have Questions?

If you cannot find an answer to your question in our FAQ, you can always contact us.

Submit a Case