PowerShell – WellKnownSIDTypes

Today I learned about WellKnownSIDTypes. These WellKnownSIDTypes are useful if the company you are working for uses Microsoft Windows in different languages. For example: If you want to get the members of the Local Administrators group you cannot simply use “Administrators” because the name of the group will be different in each language. So how can you solve this issue? By using WellKnownSIDTypes of course.

Here is an example script that will retrieve the SID of the “Administrators” group for you:

#Get the SID of the Local Group "BUILTIN\Administrators"
function Get-BuiltinAdministratorsSID
$ID = [System.Security.Principal.WellKnownSidType]::BuiltinAdministratorsSid
$SID = New-Object System.Security.Principal.SecurityIdentifier($ID, $Null)

return $SID.Value

As always you can download the example script from here. If you want to know more about WellKnownSIDTypes please have a look at my sources.




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

%d bloggers like this: