Getting multivalued properties in from Exchange
Keywords: arrays exchange adsi
Question:
I'm trying to extract the distribution list membership of an Exchange mailbox. It works great if the mailbox only belongs to one list:User="TEST1" (0) VALUE=> "TEST1" Div="TEST" (0) VALUE=> "TEST" ADsPath="LDAP://OCAREX2/cn=TEST1,cn=TEST,cn=Recipients,ou=OCAR,o=ORGANIZATION" (0) VALUE=> "LDAP://OCAREX2/cn=TEST1,cn=TEST,cn=Recipients,ou=OCAR,o=ORGANIZATION" adsUser=ObjectAccess(ADsPath,0) (297) VALUE=> 33333 Members=adsUser.memberOf (422) VALUE=> "cn=OCAR TEST,cn=Mailing Lists,cn=Recipients,ou=OCAR,o=ORGANIZATION"However, if the mailbox belongs to more than one list (ie membersOf becomes multivalued) the script fails:User="TEST1" (0) VALUE=> "TEST1" Div="TEST" (0) VALUE=> "TEST" ADsPath="LDAP://OCAREX2/cn=TEST1,cn=TEST,cn=Recipients,ou=OCAR,o=ORGANIZATION" (0) VALUE=> "LDAP://OCAREX2/cn=TEST1,cn=TEST,cn=Recipients,ou=OCAR,o=ORGANIZATION" adsUser=ObjectAccess(ADsPath,0) (312) VALUE=> 33333 Members=adsUser.memberOf (1359) VALUE=> 0 TERMINAL WIL ERROR=>1249 (Ole Object: Could not process value returned from object)Gotta be something simple, right? What's the syntax I need?Answer:
There are limitation to the type of data that the object function in WinBatch can handle. For example....Arrays, some objects have properties and methods that return an array of data or take an array as an argument. WIL cannot process these types of properties or methods.You might consider using the Beta ADSI extender to handle this....
AddExtender("wwads34I.dll") ; Set credentials. dsSetCredent("bill", "Guesswho") ; User. sUserPath = "LDAP://win2000/cn=Homer Simpson,cn=users, DC=win2000,DC=windowware,DC=com" ;Group specified with common name. sGroupPath = “LDAP://win2000/cn=Toon,DC=win2000,DC=windowware,DC=com" ; Check for group membership. if dsIsMemberGrp( sGroupPath, sUserPath) then sResult = "Is a toon" else sResult = "Is not a Toon." message(sUserPath, sResult)Unfortunately this requires that the MS ADSI support files be installed on any NT4 box.
Article ID: W14670Filename: Getting multivalued properties and Arrays.txt