Created
September 8, 2015 23:19
-
-
Save PaulStovell/17fd3b9b374b03992f59 to your computer and use it in GitHub Desktop.
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
$usernameToFind = "ITARI\Administrator" | |
Add-Type -AssemblyName System.DirectoryServices.AccountManagement | |
$contextType = [System.DirectoryServices.AccountManagement.ContextType]::Domain | |
$context = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -argumentlist ($contextType) | |
$user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($context, $usernameToFind) | |
Write-Output $user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment