IADsContainer Interface for Domain Objects

The Domain object supports the IADsContainer interface.

You can enumerate the contents of a domain container using the "For each" construct of Visual Basic.

While enumerating objects in a domain, you can use either of the following four types of Filters:

Computer

Enumerates all the computers in the domain.

Group

Enumerates all the global groups in the domain.

PrintQueue

Enumerates all the shared printers on the domain.

User

Enumerates all the global users in the domain.

If a filter is not specified or is empty, all objects in the container are enumerated (you can set the filter to "Empty" by specifying an empty string in the filter array). You can set the filter property by specifying an array of strings.

A quick example:

Dim DomContainer As IADsContainer
Dim ObjectInContainer As IADs
'Get the IADsContainer interface for the MSFT domain
Set DomContainer = GetObject("NTDS://MSFT")
'Enumerate only Users and Groups
DomContainer.Filter = Array ("User", "Group")
For Each ObjectInContainer in DomContainer
Debug.Print ObjectInContainer.ADsPath
Next ObjectInContainer

 

See Also