Recently needed to find a way to export all staff into a csv file with only their name and EmployeeID.
First I ran the GET-ADuser command below for a single user. This will display all the user’s attributes. Be sure to change username to a domain user.
get-aduser username -Properties *
Now that you have a file with all the attribues fine the attribues names and copy them out.
Get-ADUser -Filter * -Properties * -SearchBase "OU=Staff,OU=_District-Delegated,DC=EXAMPLE,DC=k12,DC=or,DC=us" | Select-Object name, EmployeeID | export-csv -path C:\Temp\staff_employeeID_2020.csv
You’ll now have a csv file with all the user names and Employee ID’s if those are the attributes you selected.