In our Company they have added another division which has thrown off our user provisioning. I have just been thrown the project being that are previous Script Admin is gone, so I am not the best with vbscript. Below is the code segment which will grab the division ID and if it equals X and the user is active it will continue. Now I want to update the code to check for X or Y and if user is active then continue. I have tried several fixes but they either pull only X or only Y. Thanks in advance for the help!
ElseIf Left(DivisionValue,2) = "X" AND StatusValue = "Active" Then
Set rootDSE = GetObject("LDAP://RootDSE")
DomainContainer = rootDSE.Get("defaultNamingContext")
Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
ldapStr = "<LDAP://" & DomainContainer & ">;(&(objectClass=user)(objectCategory=person)(info=EmpId:" & keyValue & "));adspath;subtree"
Set rs = conn.Execute(ldapStr)
While Not rs.EOF
'Do nothing but iterate since they are already in AD.
Set FoundObject = GetObject (rs.Fields(0).Value)
rs.MoveNext
ElseIf Left(DivisionValue,2) = "X" AND StatusValue = "Active" Then
Set rootDSE = GetObject("LDAP://RootDSE")
DomainContainer = rootDSE.Get("defaultNamingContext")
Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
ldapStr = "<LDAP://" & DomainContainer & ">;(&(objectClass=user)(objectCategory=person)(info=EmpId:" & keyValue & "));adspath;subtree"
Set rs = conn.Execute(ldapStr)
While Not rs.EOF
'Do nothing but iterate since they are already in AD.
Set FoundObject = GetObject (rs.Fields(0).Value)
rs.MoveNext