Find User SID

Hi everyone,

Today I needed fin a lot of user’s AD SID value’s I’ve used the below script I hope it will be usefull for you.

This command for username to SID

$user ='TestDomainMorgan'
$objUser = New-Object System.Security.Principal.NTAccount($user)
$objSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
Write-Host "Resolved user's sid: " $objSID.Value

This one for SID to Username.

$SID =’S-1-5-21-3030846253-506056721-2238127685-1109′
$objSID = New-Object System.Security.Principal.SecurityIdentifier($SID)
$objUser = $objSID.Translate([System.Security.Principal.NTAccount])
Write-Host “Resolved user name: ” $objUser.Value

I hope it is working for you.

The following two tabs change content below.

Huseyin Kartal

Latest posts by Huseyin Kartal (see all)

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir


This site uses Akismet to reduce spam. Learn how your comment data is processed.