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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logon Script by User Group.

Status
Not open for further replies.

GeoDM

Technical User
Dec 16, 2003
66
US
I have created this vbs file that maps users to drives depending on their group membership. Currently I can only get users of the Domain Admins group to map. I think the code is correct since it does work for one group but who know what else might be causing the problem. Please take a look at the code below:

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)

For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN

Select Case strGroupName
Case "Domain Admins"
objNetwork.MapNetworkDrive "f:", "\\server3\fire dept"
objNetwork.MapNetworkDrive "g:", "\\server3\accounting"
objNetwork.MapNetworkDrive "h:", "\\server3\drawings"
objNetwork.MapNetworkDrive "j:", "\\server3\manager"
objNetwork.MapNetworkDrive "k:", "\\server3\maps"
objNetwork.MapNetworkDrive "l:", "\\server3\parks-recrea"
objNetwork.MapNetworkDrive "m:", "\\server3\clerk"
objNetwork.MapNetworkDrive "p:", "\\server3\Delta_geographic_Data"
objNetwork.MapNetworkDrive "r:", "\\server3\Engineering"
objNetwork.MapNetworkDrive "t:", "\\server3\BSA_Apps"
objNetwork.MapNetworkDrive "u:", "\\server3\Planning"
objNetwork.MapNetworkDrive "v:", "\\server3\Assessing"
objNetwork.MapNetworkDrive "w:", "\\server3\Building"
Case "Domain Users"
objNetwork.MapNetworkDrive "s:", "\\server3\SHARED"
objNetwork.MapNetworkDrive "x:", "\\server3\Accounting"
objNetwork.MapNetworkDrive "n:", "\\server3\LIAA"
Case "Accounting"
objNetwork.MapNetworkDrive "g:", "\\server3\accounting"
Case "Assessing"
objNetwork.MapNetworkDrive "v:", "\\server3\Assessing"
Case "Building"
objNetwork.MapNetworkDrive "w:", "\\server3\Building"
Case "Clerk"
objNetwork.MapNetworkDrive "m:", "\\server3\clerk"
Case "DTFD Admins"
objNetwork.MapNetworkDrive "f:", "\\server3\fire dept"
Case "DTFD Officers"
objNetwork.MapNetworkDrive "f:", "\\server3\fire dept"
Case "Engineering"
objNetwork.MapNetworkDrive "r:", "\\server3\Engineering"
Case "GIS Administrators"
objNetwork.MapNetworkDrive "p:", "\\server3\Delta_geographic_Data"
Case "GIS Users"
objNetwork.MapNetworkDrive "p:", "\\server3\Delta_geographic_Data"
Case "Manager"
objNetwork.MapNetworkDrive "j:", "\\server3\manager"
Case "Parks"
objNetwork.MapNetworkDrive "l:", "\\server3\parks-recrea"
Case "Planning Dept."
objNetwork.MapNetworkDrive "u:", "\\server3\Planning"
End Select

Next

wscript.quit
 
It is. It just only works with Domain Admins.
 
It is. It just only works with Domain Admins.

Which is it, in a GPO or on a share?

If in a GPO you need to ensure the security of the GPO is set to apply to your users and the GPO must be placed at the OU where the users are located or at a higher level. Ensure that policy inherritance is not blocked.

Check what policies are applied at the clients by running GPRESULT.

If enabled via a share, have you configured the users login script through ADUC?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Its done through a share and part of the AD login script on the user. Currently I only have that setup for my username. Right now I am just testing it on individual machines logged in with different usernames by just calling the script. The only usernames that it will map drive under are the Domain Admins.
 
I know I have not published to this in a while but I did get it solved. The problem was the default group in active director. It would not map the group that was default. I changed everyones default group to Domain Users and it works fine.
 
take you data out of you logonscript. seperating your data from computation will reduce testing efforts, reduce mistakes and is 'best' practice. in the case of logonscripts it allows for a delegation...i.e. you can have different countries\locations\groups havin there own ini/xml files which they look after but are read by the central logonscript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top