PDA

View Full Version : VB log on scripts



duster
May 14, 2010, 04:03 PM
can anyone on this site help me with a vbscript. In not really a programmer but i know that a VB script would be the best language to get this done. what i want to do is map network drives for users when they log into windows domain.I want a script that looks at which active directory group the user is apart of and map a drive for the user based on which folder on the file server that group has access to. any help would be appreciated.

ramesh
May 14, 2010, 04:41 PM
I used to do this on our Netware Server, but the commands may be different on a Windows server....

juba
May 14, 2010, 06:44 PM
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 "Finance Users"
objNetwork.MapNetworkDrive "X:", "\\atl-fs-01\finance"

Case "Human Resource Users"
objNetwork.MapNetworkDrive "X:", "\\atl-fs-01\hr"

Case "Manufacturing Users"
objNetwork.MapNetworkDrive "X:", "\\atl-fs-01\manufacturing"

Case "Shipping and Receiving Users"
objNetwork.MapNetworkDrive "X:", "\\atl-fs-01\shipping"
End Select
Next

Source for above VBScript (http://blogs.technet.com/heyscriptingguy/archive/2004/12/10/how-can-i-map-drives-based-on-membership-in-a-group.aspx)

Have you considered KiXtart (http://www.kixtart.org/)? It is much easier than VBScirpt

duster
May 15, 2010, 06:07 AM
I used the link below and my mappings work. The problem i have now is that it takes about 2 minutes to complete the log in process and im only mapping a single drive in a test environment. anything i can do to speed up the process?


http://e-articles.info/e/a/title/Check-Group-Membership-and-Map-Drives-in-a-Logon-Script/

juba
May 15, 2010, 10:20 PM
Do you mind posting the entire login script?

duster
May 16, 2010, 12:54 PM
Do you mind posting the entire login script?

the script is in the link i posted the only difference is i changed the computer name to match my server...

crazeeplayer
June 4, 2011, 09:14 PM
u cud use the net use command
eg. net use g: \\server\data