I was recently asked to find the username associated with a particular Active Directory SID (technically I was given the RID).
This is actually pretty easy in PowerShell, and quite intuitive using basic AD cmdlets.
Get the user for a given RID:
Get-ADUser -Filter * | Select-Object -Property SID,Name | Where-Object -Property SID -like "*-6640"
Get the SID for a given user:
Get-ADUser -Identity ad.user | Select-Object -Property Name,SID
Hi Robin,
Get-ADUser -Identity S-1-5-21-2511372296-46634312-3923189056-2186
Much faster :)
If you need the SID portion, you can get it with :
(Get-ADDomain).DomainSID
So :
Get-ADUser -Identity “$((Get-ADDomain).DomainSID.Value)-2186” is much more efficient in large environment :)
LikeLike