Skip to content

Instantly share code, notes, and snippets.

@seanosullivanuk
Created October 2, 2020 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanosullivanuk/95bc20648e12eaf0de56880ab5e5873d to your computer and use it in GitHub Desktop.
Save seanosullivanuk/95bc20648e12eaf0de56880ab5e5873d to your computer and use it in GitHub Desktop.
Export a list of Active Directory user accounts to a CSV, grabbing specific properties.
Get-ADUser -Filter 'title -ne 0' -Properties givenName,sn,title,mail,sAMAccountName |select-object givenName,sn,title,mail,sAMAccountName | convertto-csv -Delimiter "`t" -NoTypeInformation | Select-Object -Skip 1 | % { $_ -replace '"', ""} | out-file "EmployeeExport.csv" -fo -en ascii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment