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 :
Any help would be appreciated !Code: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


Reply With Quote