txgeekgirl
Registered User.
- Local time
- Today, 08:12
- Joined
- Jul 31, 2008
- Messages
- 187
I have a routine that adds users to Active Directory user groups. I need to write a little check around the .Add to where if the person is a member of that group, it will skip and move on. I can't seem to get the syntax correct. Any suggestions? 
Code:
' Add the user to a group
Dim index As Integer
Dim sEachGroup As String
Dim IsMember As Boolean
Do While Len(sGroupName) > 0
'End of list - can't have a string going from 1 to 0
If InStr(sGroupName, ",") <> 0 Then
index = InStr(sGroupName, ",")
Else
index = 50
End If
sEachGroup = Mid(sGroupName, 1, index - 1)
'MsgBox (sEachGroup)
StrobjGroup1 = "[URL="ldap://cn/"]LDAP://cn[/URL]=" & sEachGroup & ",cn=Users,DC=pbmhmr,DC=com"
Set objGroup1 = GetObject(StrobjGroup1)
'INSERT CHECK HERE
objGroup1.Add (oUser.ADsPath)
UpdateDBLog sEachGroup, FullName, ID
sGroupName = Mid(sGroupName, index + 1)
Loop