Skip to content

Instantly share code, notes, and snippets.

@mbrownnycnyc
Created September 2, 2014 19:45
Show Gist options
  • Save mbrownnycnyc/48a88ac982e9e09ff2c9 to your computer and use it in GitHub Desktop.
Save mbrownnycnyc/48a88ac982e9e09ff2c9 to your computer and use it in GitHub Desktop.
get an AD user from a sid
function get-aduserbysid{
#http://community.spiceworks.com/how_to/show/2776-powershell-sid-to-user-and-user-to-sid
param(
[string]$domain,
[string]$sid
)
$objSID = New-Object System.Security.Principal.SecurityIdentifier `
("$sid")
$objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
$objUser.Value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment