Hello!
First i would like to say sorry for my "not-so-good english". Please ask if you dont understand what im trying to write![]()
I am very new to VB. I am trying to make a login script in VB that maps different networkdrives based on what group (security group in AD) the user is a member of. I have written a little bit. But it doesnt work as i want it to.
It looks something like this:
I found a version af this when i searched on google and i changed it to match my server and folders. But i must have made some misstake because it doesnt work.Code:Option Explicit Const STAFF = "cn=staff" Const STUDENTS = "cn=students" Dim wshNetwork, CurrentUser, strGroups Set wshNetwork = CreateObject("WScript.Network") Set ADSysInfo = CreateObject("ADSystemInfo") Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) strGroups = LCase(Join(CurrentUser.MemberOf)) 'STAFF If InStr(strGroups, STAFF) Then wshNetwork.MapNetworkDrive "J:", "\\SERVER\Shared\" wshNetwork.MapNetworkDrive "I:", "\\SERVER\Shared\" End If 'STUDENTS ElseIf InStr(strGroups, STUDENTS Then wshNetwork.MapNetworkDrive "I:", "\\SERVERl\Shared\" End If
Also the security group named STAFF includes 2 other security groups. One of thoose groups should only get "I:" mapped. I assumed that will happen automaticly since that group doesnt have any rights to "J:"..?
Is it at all possible to do all this in one script? I read that you could also do 2 scripts for this. But i thought makeing one would be easier.
I hope you understand. And please ask if there is any other information needed to solve this.
Thanks! xoxo Lisa.




Reply With Quote