Powershell how to get SID of AD user

You can use the following simple Powershell command to get the SID of an Active Directory user:

Get-ADUser [username]

This will give the following output:

DistinguishedName : CN=[username]U=Accounts,OU=Resources,DC=ad,DC=local
Enabled           : True
GivenName         : User1
Name              : User1
ObjectClass       : user
ObjectGUID        : 0e11261d-1880-46b7-8dcd-37d04d7f89ed
SamAccountName    : user1
SID               : S-1-5-21-3314419218-4032226268-1344692420-33978
Surname           : LastName
UserPrincipalName : user1@ad.local

Retrieve the SID from this line:

SID               : S-1-5-21-3314419218-4032226268-1344692420-33978

I hope this helped you!

By Leendert de Borst

Freelance software architect with 10+ years of experience. Expert in translating complex technical problems into creative & simple solutions.

Leave a comment

Your email address will not be published. Required fields are marked *