Downloads
24596.zip

I'm writing a script that displays the groups to which a global group belongs. I'm using the Microsoft Active Directory Service Interfaces (ADSI) IADs interface's Get method to retrieve the global group's memberOf property. The code works fine as long as the global group is a member of only one group. If the global group belongs to more than one group, the script generates a Type Mismatch error (error code 800A000D). What am I doing wrong?

The problem lies with using the IADs interface's Get method. Because the memberOf property is a multivalued attribute, you shouldn't use this method. To successfully retrieve the memberOf property's values, you need to use the ADSI IADs interface's GetEx method, as Listing 2 shows. Then you can use VBScript's For Each...Next statement to enumerate the results.