Created
September 2, 2014 19:45
-
-
Save mbrownnycnyc/1c384f3863cf21b4305e to your computer and use it in GitHub Desktop.
get a sid for an AD user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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