You are on page 1of 2

tinyapps.

org / docs / Automatically Map Network Drives on Domain Login for All
Users, Certain Users, or Certain Groups

As always, use the following instructions at your own risk (and joy). Please submit
any corrections or comments if you feel so moved.

Auto map network drives on login for all users

Save the following batch file to the domain controller's NETLOGON share as
logon.bat:
@echo off
net use * /delete /yes
net use x: \\server_name\shared_directory_name
Active Directory Users and Computers
Right click domain name at top left and click Properties > Group Policy > Edit >
User Configuration > Windows Settings > Scripts (Logon/Logoff) > Logon > Add...
Enter path to logon.bat (e.g., \\ACME.local\sysvol\ACME.local\scripts\logon.bat)
and click OK three times
Login from workstation. Drive x: should appear in My Computer.
Auto map network drives on login for certain users:

Save the following batch file to the domain controller's NETLOGON share as
logon.bat:
@echo off
net use * /delete /yes
net use x: \\file_server_name\shared_directory_name
Active Directory Users and Computers > Users > Double click user > Profile
Enter "logon.bat" (no quotes) in the "Logon script" box and click OK
Login from workstation as user modified in step 2. Drive x: should appear in My
Computer.
Auto map network drives on login based on Group membership

Get KiXtart
Put WKIX32.EXE in both the domain controller's NETLOGON share and %SystemRoot%
(normally C:\WINNT\).
Save the following script as map_drive.kx to the NETLOGON share (be sure to change
the group as needed - here we've used Domain Users):
use "*" /DELETE
if ingroup("Domain Users")
use x: "\\server_name\share_name"
endif
Save the following batch file (which calls your KiXtart script) as login.bat to the
domain controller's NETLOGON share:
@echo off
\\server_name\NETLOGON\WKIX32.EXE \\server_name\NETLOGON\map_drive.kx
Active Directory Users and Computers
Right click domain name at top left and click Properties > Group Policy > Edit >
User Configuration > Windows Settings > Scripts (Logon/Logoff) > Logon > Add...
Enter path to login.bat (e.g., \\ACME.local\sysvol\ACME.local\scripts\login.bat)
and click OK three times
Login from workstation as a user belonging to group designated in map_drive.kx.
Drive x: should appear in My Computer.
If x: does not appear, check the permissions of NETLOGON, WKIX32.EXE, your script
files, etc. Also, make sure that the user or group has the necessary permissions on
the shared folder you are mapping.
More KiXtart Examples

Map drive if user is *not* a member of a certain group (in this case, "Students"):
If InGroup("Students") = 0
Use R: "\\server\records"
EndIf
Using Boolean operators:
If InGroup("Teachers") Or InGroup("Office") Or InGroup("PTA")
Use G: "\\server\Grownup_Files"
EndIf

If InGroup("2008 Class") And InGroup("Honors")


Use S: "\\server\smart_kids"
EndIf
Using Select...EndSelect (stops processing on the first true Case)
Select
Case InGroup("Students")
Use S: "\\server\student_storage"
Case InGroup("Office")
Use O: "\\server\office_docs"
Use R: "\\server\records"
Case InGroup("Teachers")
Use O: "\\server\office_docs"
Use S: "\\server\student_storage"
Use T: "\\server\teaching_materials"
EndSelect
last update: 2008.02.12

You might also like