Please help! I have been trying to get the following code to work,
which should loop through two OU's and delete any duplicates from the
2nd OU. It is failing on the objOU2.Delete line with "An Invalid dn
syntax has been specified". This error normally indicates an invalid
LDAP string has been used, but I can echo the contents of
objContact1.cn and objContact2.cn as it iterates through the loops just
fine. Can anyone help me understand why the delete will not work, and
suggest another way I might can make this work. Thanks!
Code starts here:
Set objOU1 =
GetObject("LDAP://OU=Pager,OU=Users,OU=Divisions,DC=MyDomain,DC=com")
objOU1.Filter = Array("contact")
Set objOU2 =
GetObject("LDAP://OU=PagerOther,OU=Users,OU=Divisions,DC=MyDomain,DC=com")
objOU2.Filter = Array("contact")
For Each objContact1 In objOU1
For Each objContact2 In objOU2
If objContact1.cn = objContact2.cn then
objOU2.Delete "contact", "cn=" & objContact2.cn
Exit For
End If
Next
Next