IADsContainer Interface for RegistryKey Objects

The RegistryKey object supports the IADsContainer interface. Certain special considerations apply when you use this interface with File objects.

The Count property is not implemented for RegistryKey objects.

You can enumerate the contents of a RegistryKey container using the "For Each " construct of Visual Basic. Enumeration is possible only for keys. An IADsContainer for a RegistryKey object contains objects of type IRegistryKey.

While enumerating objects in a directory, you can use any of the following types of Filters:

Complete tree key

Recursive enumeration of all keys

Complete tree

Recursive enumeration of all keys and values

Nextlevel key and value

Non recursive enumeration of keys and values

Nextlevel key

Non recursive enumeration of keys

Nextlevel value

Non recursive enumeration of values

A quick example:

Dim RegContainer As IADsContainer
Dim RegistryKey As IRegistryKey
'Get the IADsContainer interface for the Entevo key
'Note the forward and backward slashes
Set RegContainer = GetObject("NTDS://DomainName/MachineName/reg_services/HKEY_LOCAL_MACHINE\SOFTWARE\Entevo")
'Enumerate all keys in one level
RegContainer.Filter = "Nextlevel key"
For Each RegistryKey in RegContainer
Debug.Print RegistryKey.RelativePath
Next RegistryKey

 

See Also