Skip to content

Instantly share code, notes, and snippets.

@johnbocook
Last active March 16, 2021 07:14
Show Gist options
  • Select an option

  • Save johnbocook/91ea026c835470ba16d4905fc3752d17 to your computer and use it in GitHub Desktop.

Select an option

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