This is getting a bit complex for me (I think). I'm trying to incorporate a
section in my logon script that will determine which department(s) (i.e.
global groups; math, social, science, English...) a user is a member of and
will then map the S drive to that department's share. The initial drive
letter needs to be S. And if users are a member of 2 or 3 departments, they
may recieve a T and U drive too. Below is my code for the 'map the next
available drive' part. Then I try to add the isMember part and I'm getting
a bit confused (or maybe timid is a better word!) Would my best route be to
add a 'for each loop' that surronds the 'next available drive' code. And
loop would enumerate if the user was a member of each group listed in the
'for each loop' and assign a drive accordingly?
CODE
___________________________________________________
'Map S (departmental) drives
'Will also get a T drive if they're a member of 2 departments
'Will also get a U drive if they're a member of 3 departments
objNetwork.RemoveNetworkDrive "S:"
objNetwork.RemoveNetworkDrive "T:"
objNetwork.RemoveNetworkDrive "U:"
' This sections creates two objects:
' objShell and objNetwork and then counts the drives
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set CheckDrive = objNetwork.EnumNetworkDrives()
' This section operates the For ... Next loop
' See how it compares the enumerated drive letters
' With strDriveLetter
On Error Resume Next
DriveExists = False
' Sets the Outer loop to check for 3 letters in strAlpha
For intCount = 1 To 3
DriveExists = False
' CheckDrive compares each Enumerated network drive
' with the proposed drive letter held by strDriveLetter
For intDrive = 0 To CheckDrive.Count - 1 Step 2
If CheckDrive.Item(intDrive) = strDriveLetter _
Then DriveExists = True
Next
intAlpha = intAlpha + 1
' Logic section if strDriveLetter does not = DriveExist
' Then go ahead and map the drive
If DriveExists = False Then objNetwork.MapNetworkDrive strDriveLetter,
strRemotePath
' Appends a colon to drive letter. 1 means number of letters
strDriveLetter = Mid(strAlpha, intAlpha,1) & ":"
' If the DriveExists, then it is necessary to
' reset the variable from true --> false for next test loop
If DriveExists = True Then DriveExists = False
Next