Skip to content

Instantly share code, notes, and snippets.

@varnav
Last active August 22, 2017 09:18
Show Gist options
  • Save varnav/0666ed5a099d7da447f3e85d4653e7eb to your computer and use it in GitHub Desktop.
Save varnav/0666ed5a099d7da447f3e85d4653e7eb to your computer and use it in GitHub Desktop.
Export Active Directory users to simple txt file, one user per line
Get-ADUser -SearchBase "DC=domain,DC=local" -Filter {(mail -ne "null") -and (Enabled -eq "true")} | Format-Table -HideTableHeaders SamAccountName | Out-File d:\aduserlist.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment