I am trying to run a script during our user provisioning process to add users to a group based on selected criteria. Here's a code snippet below. I cannot sort out how to actually add the user to the group as the foundobject.ismember appartently doesn't work
While Not rs.EOF
'Do nothing but iterate since they are already in AD.
Set FoundObject = GetObject (rs.Fields(0).Value)
'Found in AD
If Instr(FoundObject.DistinguishedName,"Terminated Employees") = 1 Then
rs.MoveNext
End If
rs.MoveNext
userChanged = False
If IsNull(FoundObject) Then
Else
If (Left(DepartmentValue,3) = "251") Then
Set objGroup = GetObject("LDAP://CN=GROUP1,OU=Groups,OU=LOCATION,DC=XYZ,DC=com")
'check to see if user member of GROUP1
If (FoundObject.IsMember("LDAP://CN=GROUP1,OU=Groups,OU=LOCATION,DC=XYZ,DC=com") = FALSE) Then
'Add User to Heartland Schools Solutions DL
objGroup.Add(FoundObject)
userChanged = True
End If
End If
End If
Set FoundObject = Nothing
Wend
While Not rs.EOF
'Do nothing but iterate since they are already in AD.
Set FoundObject = GetObject (rs.Fields(0).Value)
'Found in AD
If Instr(FoundObject.DistinguishedName,"Terminated Employees") = 1 Then
rs.MoveNext
End If
rs.MoveNext
userChanged = False
If IsNull(FoundObject) Then
Else
If (Left(DepartmentValue,3) = "251") Then
Set objGroup = GetObject("LDAP://CN=GROUP1,OU=Groups,OU=LOCATION,DC=XYZ,DC=com")
'check to see if user member of GROUP1
If (FoundObject.IsMember("LDAP://CN=GROUP1,OU=Groups,OU=LOCATION,DC=XYZ,DC=com") = FALSE) Then
'Add User to Heartland Schools Solutions DL
objGroup.Add(FoundObject)
userChanged = True
End If
End If
End If
Set FoundObject = Nothing
Wend