Skip to content

Instantly share code, notes, and snippets.

@johnbocook
Last active March 16, 2021 07:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnbocook/91ea026c835470ba16d4905fc3752d17 to your computer and use it in GitHub Desktop.
Save johnbocook/91ea026c835470ba16d4905fc3752d17 to your computer and use it in GitHub Desktop.
Powershell Active Directory Search
$username = Read-Host -Prompt 'Type in the username:?'
csvde -f searchAD.txt -p subtree -l "sAMAccountName,cn,distinguedName" -r "(&(objectClass=User)(sAMAccountName=$username))"
Import-Csv .\searchAD.txt | Out-GridView -Title "Active Directory"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment