Skip to content

Instantly share code, notes, and snippets.

@mbrownnycnyc
Created September 2, 2014 19:45
Show Gist options
  • Select an option

  • Save mbrownnycnyc/1c384f3863cf21b4305e to your computer and use it in GitHub Desktop.

Select an option

Save mbrownnycnyc/1c384f3863cf21b4305e to your computer and use it in GitHub Desktop.
get a sid for an AD user
function get-adusersid{
#http://community.spiceworks.com/how_to/show/2776-powershell-sid-to-user-and-user-to-sid
param(
[string]$domain,
[string]$user
)
$objUser = New-Object System.Security.Principal.NTAccount("$domain", "$user")
$strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
$strSID.Value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment