1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
Dim Domaine As IADsDomain
Dim Utilisateurs As IADsUser
Dim strDomaine As String
On Error Resume Next
'Utiliser les services d'annuaire WinNT
strDomaine = "WinNT://" & txt_domaine.Text
'Créer l'objet Domaine
Set Domaine = GetObject(strDomaine)
'Rechercher les utilisateurs dans le domaine
Domaine.Filter = Array("User")
With grd_domaine
.Redraw = False
.Rows = 1
.Row = 0
For Each Utilisateurs In Domaine
.Rows = .Rows + 1
.Row = .Rows - 1
.Col = 0
.Text = Utilisateurs.Title
.Col = 1
Utilisateurs.GetInfo
.Text = Utilisateurs.Get("userPrincipalName")
.Col = 2
.Text = Utilisateurs.Name
.Col = 3
.Text = Utilisateurs.LastLogin
.Col = 4
.Text = Utilisateurs.Description
.Col = 5
.CellAlignment = 4
.Text = Utilisateurs.AccountDisabled
If (Utilisateurs.AccountDisabled = True) Then
For i = 0 To 6
.Col = i
.CellBackColor = &HC0C0FF
Next
End If
Next Utilisateurs
.Redraw = True
End With
'Nettoyer
Set Domaine = Nothing |
Partager