Hi guys. Based on the fast response I got in my last post. I was assigned a new project, and got so far: I need more help. Essentially the following code returns the Groups the Current logged in user is part of. I want to then string compare the Group to a const MedicalLab "CN=Medical Lab" and them map the appropriate drive. We have over 130 groups. any help.THANKS
Option Explicit
On Error Resume Next
Dim objNetwork, strDomain, strUser, objUser, objGroup, strGroupMemberships, colDrives, i
' Get the domain and username from the WScript.Network object
Set objNetwork = CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
strDomain = objNetwork.UserDomain
strUser = objNetwork.UserName
' Instanciate the user object from the data above
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser)
'Force Removal of network drive
For i = 0 to colDrives.Count-1 Step 2
objNetwork.RemoveNetworkDrive colDrives.Item(i),TRUE,TRUE
Next
WScript.sleep 2000
' Run through the users groups and put them in the string
For Each objGroup In objUser.Groups
strGroupMemberships = strGroupMemberships & objGroup.Name & " , "
Next
MsgBox strGroupMemberships