[IMPORTANT] Please note that this site will be disabled on October 31. In it's place, the new JumpCloud Help Center is live! Check it out here!

Support Center

Map a Network Drive with JumpCloud Commands

There are many different methods for mapping a drive.  This article will provide for mapping a network drive upon login using a registry entry and a batch file without the need of storing a password in plain text.

This method assumes the file server is setup with permissions using the method described on the JumpCloud Engineering blog here.

Note: 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 /f
mkdir c:\scripts
echo net use * /delete /yes > c:\scripts\netuse.bat
echo net use g: "\\fileserver\share" /user:%%username%% >> c:\scripts\netuse.bat
For this example, name it setnetdrive.bat

          2. Create a Command in the JumpCloud admin console, deselect powershell.  The contents of the command as follows:
cmd.exe /c c:\windows\temp\setnetdrive.bat

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.  

*If running a 32-bit operating system modify the command in Step 2 to:
%windir%\sysnative\cmd.exe /c c:\windows\temp\setnetdrive.bat

Last Updated: Jan 30, 2019 07:53AM MST

Related Articles
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found