Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Map drives for users at logon 1

Status
Not open for further replies.

mquinn0908

Technical User
Jul 3, 2002
335
US
I would like to map drives for my users when they log on based off of their group memberships.

If possible I would like to map their department drive to S: and the users that are in their department's admin group I would like to map that drive to T: and I would like to know if there is a way to do this.

I have departmental groups (with shared drives) like Highway, Probate, Revenue and then these departments may have an admin share such as Highway Admin and that user would need to map highway user and highway admin. Thank you.

Mandy
MCP/A+/Network+
 
Create OU's in Active Directory for each department and place the user accounts in their respective departmental OU. Configure the proper Logon Scripts to map the drives and link them to the proper OU using a GPO.

Alternatively, if all the client computers have Group Policy Preference Client Side Extensions installed, then you can take advantage of Group Policy Preferences in Windows Server 2008 to map these drives. Below are some links where you can gather information about this new functionality.

- Information about new Group Policy preferences in Windows Server 2008


- Download details: Group Policy Preferences Overview




Joey
CCNA, MCSA 2003, MCP, A+, Network+, Wireless#
 
I made a vbs script for my logon script that will do what you want w/o setting up different OUs and such.

This code does the lookup:
Code:
Private Function IsMember(groupName) 'Check to see if a user belongs to a group. Boolean
	Dim grp, blnIsMember, userObj
	blnIsMember = False
	Set userObj = GetObject("WinNT://" & sDomain & "/" & sUser & ",user")
	For Each grp In userObj.Groups
		If grp.Name = groupName Then
			blnIsMember = True
			Exit For
		End If
	Next
	Set userObj = Nothing
	IsMember = blnIsMember
End Function
And this is how I use that function to map a drive.

Code:
Set oNet = CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
sUser = oNet.UserName
sDomain = oNet.UserDomain
If NOT objFSO.DriveExists("p:") Then
	If IsMember("Human Resources") Then
	oNet.MapNetworkDrive "p:", "\\server.domain.com\sharename", True
	End If
End If
Set objFSO = Nothing
Set oNet = Nothing
 
GPP is the preferred way for a 2008 implementation, however please note that you need to have the CSE installed on all workstations in order for GPP to work.



GPP CSEs for Windows Vista (KB943729)
GPP CSEs for Windows Vista x64 Edition (KB943729)
GPP CSEs for Windows Server 2003 (KB943729)
GPP CSEs for Windows Server 2003 x64 Edition (KB943729)
GPP CSEs for Windows XP (KB943729)
GPP CSEs for Windows XP x64 Edition (KB943729)

If you are in a mixed environment then I would say stick with VBScript Login Scripts. As 58Sniper pointed out, I have an extensive FAQ on the subject. faq329-5798

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top