Home > Coding > Getting user GUID from Active Directory.

Getting user GUID from Active Directory.

Sometimes you need to get a GUID for an entry in Active Directory. There are several tools available to do this. This is just one example how you could approach this.

To go the network where you can search/browse AD.

Perform a search and modify the columns you want to view. Look for a Distinguished Name property and add it. We will use it to retrieve the GUID.

Create a simple vbs script to retrieve the GUID and write it to a text file.

Set objFSO = CreateObject("Scripting.FileSystemObject")
ForWriting = 2
Set file = objFSO.OpenTextFile("C:\Windows\Temp\guid.txt", ForWriting, true)
Set sampleUser = GetObject("LDAP://CN=Wytze,OU=office,DC=example,DC=org")
file.WriteLine("User: " & sampleUser.Name & " " & sampleUser.Guid)


  1. No comments yet.
  1. No trackbacks yet.

Time limit is exhausted. Please reload CAPTCHA.