Retrieving SID in Powershell

 

Retrieving a SID can be usually done with psgetsid or whoami /all

Here’s a quick snippet to help get you the Secure Identifier (SID) of a local or domain Windows Account within Powershell

<pre class="lang:ps decode:true " title="Getting a SID">$u = New-Object System.Security.Principal.NTAccount('username')
$SID = $u.Translate([System.Security.Principal.SecurityIdentifier])
$SID.Value

And here’s an example:

Retrieving SID in Powershell

In case you need to check the well-known SID, they are listed in this article.