powershell script to list users and there OU under a specific OU and export to csv

I need a powershell script to list users and there ou given a specific OU to look under and then export this to CSV

any help much appreciated
Who is Participating?
KenMcFConnect With a Mentor Commented:
You cna use the Quest AD cmdlets.

Change the searchroot to match your Env and add any attributes needed.

get-qaduser -searchroot "OU=USERS_ACCOUNTS,DC=DEVLAB,DC=LOCAL" | Select Name, Parentcontainer | Export-csv C:\temp\users.csv -notype
davidm27Author Commented:
cheers worked perfectly
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.