FeaturedMicrosoftTools

Powershell – Export users and select attributes from a single OU

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.

Show More

Cory Fiala

Technology and outdoor enthusiast. Anything from desktops to servers with a side of mountain biking and skiing. Life is good!

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button