IADsContainer Interface for Computer Objects

The Computer object supports the IADsContainer interface.

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

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


Enumerates all local groups in the computer.


Enumerates all the print queues of the computer.


Enumerates all services of the computer and all device drivers installed on the computer.


Enumerates all local users on the computer.

For the Computer container, if the filter is not specified, all objects in the container and "file_services" and " reg_services" objects are enumerated. You can set the filter to "Empty" by specifying an empty string in the filter array. The filter property is set by specifying an array of strings.

A quick example:

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


See Also