Get the Security Identifier SID of a Windows account.

In case you find yourself in a situation where you need to get the SID of a user account here are a few ways to do it.

Local account with PowerShell – http://technet.microsoft.com/en-us/library/ff730940.aspx

PS > $ob = New-Object System.Security.Principal.NTAccount(“test”)
//Where “test” is the local account name

PS > $sid = $ob.Translate([System.Security.Principal.SecurityIdentifier])
//Now $sid contains the value of $ob translated to it’s SID

PS > $sid.Value
//Just echo the value

Get.SID.1

You can grab a domain user the same way by replacing “test” above with “domain\test”

There are some other great PowerShell and SID resources at http://blogs.technet.com/b/heyscriptingguy/archive/2010/10/11/use-wmi-and-powershell-to-get-a-user-s-sid.aspx

If you are just concerned with a SharePoint 2010 managed account you can also use;

$(Get-SPManagedAccount -Identity “THE SERVICE ACCOUNT”).Sid.Value

And if you’re still not super comfortable with PowerShell this is where you can find it in the registry.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion \ProfileList
//Under the ProfileList key you will see the SIDs and you can check the value for ProfileImagePath to see what username is ascociated with which SID. The main drawback to this method is that the account must have logged into the computer at some point to have a profile value.

About these ads

About Mr_SHeister

Geek, Dad, SharePoint Administrator
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

2 Responses to Get the Security Identifier SID of a Windows account.

  1. Thanks for your article, but it not working for me…
    Could u please provide any other solution….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s