Link to home
Start Free TrialLog in
Avatar of serverbob
serverbob

asked on

Windows 2008 VB logon script map drive by group membership

Hello,

I used a basic VB script I found on a microsoft site.  The home directory part is working but the group membership mappings are not working. If anyone can tell me what Im doing wrong id appreciate it.  Here is the script I used:


Const Finance_GROUP     = "cn=SG_Finance"
Const IT_GROUP          = "CN=SG_IT"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:","\\njfile\us$\" & wshNetwork.UserName

Set adSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, finance_GROUP) Then

    wshNetwork.MapNetworkDrive "J:","\\njfile\finance"

ElseIf InStr(strGroups, IT_GROUP) Then

    wshNetwork.MapNetworkDrive "J:","\\njfile\it$\"


End If
ASKER CERTIFIED SOLUTION
Avatar of Kent Dyer
Kent Dyer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of serverbob
serverbob

ASKER

Thanks everyone.  Got it working!