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
| Sub detailUser(ByVal login As String, ByVal champTxt As RichTextBox)
champTxt.Clear()
Dim ds As New DirectorySearcher()
ds.Filter = "samaccountname=" & login
Dim sr As SearchResult = ds.FindOne()
Dim sb As New System.Text.StringBuilder()
For Each var As String In sr.Properties.PropertyNames
RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Bold + FontStyle.Underline)
RichTextBox1.AppendText(var.ToUpper & vbNewLine)
RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Regular)
If sr.Properties(var)(0).ToString() = "System.Byte[]" Then
Dim oSID As SecurityIdentifier = New SecurityIdentifier(CType(sr.Properties("objectSid")(0), Byte()), 0)
champTxt.AppendText(oSID.Value.ToString & vbNewLine & vbNewLine)
Else
champTxt.AppendText(sr.Properties(var)(0).ToString() & vbNewLine & vbNewLine)
End If
Application.DoEvents()
Next
End Sub |
Partager