email

Tuesday, November 3, 2009

Fetch the SID of a user account using PowerShell


If you want to find-out the SID of a Domain(or local) user using powershell, here is the code.

Get the SID of domain User:

write-host (new-object System.Security.Principal.NTAccount "domain\user").Translate([System.Security.Principal.SecurityIdentifier]) -b yellow -f red

Get the SID of local User:

write-host (new-object System.Security.Principal.NTAccount "administrator").Translate([System.Security.Principal.SecurityIdentifier]) -b yellow -f red

If you are a programming geek and want to convert this into cmdlet(say get-sid), you can find some info here at http://www.clariusconsulting.net/blogs/pga/archive/2006/08/08/643.aspx
Happy Learning,

Sitaram Pamarthi

No comments:

Post a Comment