Retrieve GUID on all users in Active Directory
Posted on 2014-11-03
I currently pull a list of all the Active Directory users on the network.
What I need now is their GUID.
The GUID is the same for every user. So I don't think it's correct.
Here's the code.
Dim userEntry As DirectoryEntry
userEntry = New DirectoryEntry("LDAP://nicb.org/CN=Users")
Dim ADEntry As New System.DirectoryServices.DirectoryEntry("WinNT://xxx.org")
For Each userEntry In ADEntry.Children
Dim thisGuid As String
Dim oGuid As Guid
If userEntry.SchemaClassName = "User" Then
oGuid = userEntry.Guid
thisGuid = oGuid.ToString
Response.Write(userEntry.Properties("FullName").Value.ToString & " / " & userEntry.Name.ToString & " / " & thisGuid & "<br>")
I'm using ASP.NET 4.0 VB web app.