PDA

Click to See Complete Forum and Search --> : ADSI : List computers in specific OU & domain


eL_NiNo
Apr 16th, 2002, 01:53 PM
Hi !

I have a problem and I don't have any clue on how to do this :

Suppose I have a domain : strDomain = "MyDomain" and an OU : strOU = "Users"

I want to list all computers located in this domain and OU.

I'm using something like this but it ain't working :


Sub ListePostes(strDomain As String, strOU As String, lstListe As ComboBox)

Dim cxPostes As Object, cxPoste As Object

Set cxPostes = GetObject("WinNT://" & strDomain & "/" & strOU)
cxPostes.Filter = Array("computer")

With lstListe
.Clear
.AddItem ""
For Each cxPoste In cxPostes
lstListe.AddItem cxPoste.Name
Next
End With
lstListe.ListIndex = 0
Set cxPostes = Nothing

End Sub


Any help would be appreciated !