Find SID of account using PowerShell

Find SID of account using PowerShell

Different ways to find the SID of objects in Active Directory.

Q. How can I find the SID of a user or other object using PowerShell?

A. There are a number of different methods to find the SID of an object. A simple way is as follows:

$name = '[email protected]'
(New-Object System.Security.Principal.NTAccount($name)).Translate([System.Security.Principal.SecurityIdentifier]).value

Simply change the name of the object in the $name variable. Note the above is really a condensed version of:

$AdObj = New-Object System.Security.Principal.NTAccount('[email protected]')
$strSID = $AdObj.Translate([System.Security.Principal.SecurityIdentifier])

Another option to find the name of a user account is using Get-ADUser:

Get-ADUser -Identity 'honeypot' | select SID

You could also use Get-ADGroup and other cmdlets for other types of object.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.