Wednesday, 9 June 2021

Network Drive Mapping using GPO and Bat files

Its very common practise in large organisations to map the shared folders using GPO. It can save time for the administrator to go to each computer and map them one by one. 


Lets see how we can do the mapping here.. 

You need a domain controller and a client computer connected to domain ( member) 

In my case i have created two OUs and each OUs has two users. I am going to create mapping to all the users. To do this..

1) need to have shared folders

2) Need a Bat file and save under  sysvol folder 

 C:\Windows\SYSVOL\sysvol\YOUR_DOMAIN_NAME\Script

3) need a GPO

Save the 

Step 1) sharing a folder : 

Create a new folder ,--> Right Click --> Property --> sharing on the top 2nd tab. 

Add who needs to be given permission to read and write in this folder.. remove others except Administrator. 


Step 2) Need a Bat file.

Open the Notepad and save it as .bat ( make sure no .txt is attached with the file extension) 

if you are not sure how to save as .bat file ( read here )

@echo off
net use S: \Delete
net use S: \\server\data
net use P: \\server\Print

You can add as many as shared folders with the command net use S: \\server\data,  make sure to change the drive letter and File path. 

save this file under 

 C:\Windows\SYSVOL\sysvol\YOUR_DOMAIN_NAME\Script


Go to your Group policy manager and create a new policy under the specific OU in group policy manager and edit that. 


Option 2: 


Under user configuration --> Preference --> Windows Setting --> Drive maps --> right click --> new --> mapped Drive. 

Specify the location \\servername\path.

select a Drive Letter to show when mapped. 



Thanks all you login to client PC and you should be able to see the map Drive. 

No comments:

Http vs Https