Mapping network drive using Group Policy is very flexible and has better chance to show mapped drives correctly compared to logon script. This is because Group Policy always refreshed periodically in the background. Anytime connection to the Domain Controller can be established, drives can be mapped. Even with the existence of newer technology such as Sharepoint, shared network drive is still a commonly requested feature in any type of organizations. Usually this network drive connects to a file server where users can simply store their files and share it to other users in the network. Folders can be easily be organized and sharing permission can be managed as well. For years, IT administrator typically map network drive for the users using logon script. However, there is a more effective way to do that if the administrator know how to map network drive using Group Policy Preference.
How to Map Network Drive using Group Policy Preference
In this scenario, Domain Controller is installed on Windows Server 2012 R2 named asaputra-dc1, and a client running Windows 10 is joined to domain asaputra.com. A folder in DC is shared to the network with UNC path \\asaputra-dc1\GlobalShared. This example shows how you can map this network folder to the domain joined machine.
1. Creating the policy object
At first new group policy object needs to be created in the domain controller. Open GPMC in domain controller to create a new GPO. Here, I have named it “Global OS” as shown below.
2. Modifying the policy
Right click on the policy object and select Edit. The policy that we’re looking for is under User Configuration > Preferences > Windows Settings > Drive Maps, see picture below for reference.
Right click on Drive Maps and select New > Mapped Drive as shown in below:
3. Configuring drive properties
The prompt window to create drive mapping will appear
On the Action dropdown menu, there are four types of action:
- Create: This action will create a new mapped drive for user
- Replace: This action will delete the specified mapped drive, if it exist, and then re-create a new mapped drive. If the mapped drive is not exist, this action will create a new mapped drive for user.
- Update: This action will modify the configuration of the specified mapped drive, if it exist. If the mapped drive is not exist, this action will create a new mapped drive for user.
- Delete: This action will delete a specified mapped drive for user
Other settings are available here are explained below:
- Location: Specify the location of the network drive in UNC path format
- Reconnect: If you tick the box, the drive will be persistent. Otherwise, it will be removed on user logoff.
- Label as: Specify the name of the mapped drive. If you don’t, it will use the folder name by default.
- Drive letter: Assign the drive letter to be used. There are two options here, you can choose either to automatically assign the first available letter or directly assign a letter to the mapped drive.
- Connect as: Specify the credential to be used here if the mapped drives requires different username than the current logged on user
- Hide/show this drive: Decide if you want to make this mapped drive shown or hidden in Windows Explorer
- Hide/show all drives: Decide if you want to make all physical and mapped drives to be shown or hidden in Windows Explorer.
Following the scenario explained above, our configuration looks like this:
We leave all other settings as default. Click OK to save the settings.
4. Applying to the user OU
Since this is a user setting, the GPO must be applied to OU where user accounts resides. But in this example we will just going to link it to the domain root because we want it to be applied globally to all user OUs.
When the policy has applied successfully, the mapped network drive will appear on the clientdrive list
Mapped network drive will show up almost instantly when the policy has been refreshed. The command gpupdate /force can always be used to force the Group Policy update and expedite the network drive mapping. If mapped drive fails to appear, first thing to do make sure the policy has been applied correctly to the user account. You can check policy being applied to the user by issuing gpresult /r on Command Prompt.
In our example, drive maps setting is configured in a policy object named “Global OS” and we can see that it has been applied correctly. If policy has been applied but network drive is still not mapped, then the next thing to do is to make sure the assigned drive letter is not already in use for manual mapping.
Note that drive maps actions are all based on the drive letter. Action “Create” and “Update” will not work if the drive letter already in use. In this case, the action “Delete” or “Replace” might be helpful.
And that’s how to map network drive using Group Policy preferences.