Powershell command to Pull "Display Name" "Job Title" "Department" "Manager" and "Direct Reports" for each user

Hey guys, I need a little help crafting a powershell command to pull "Display Name" "Job Title" "Department" "Manager" and "Direct Reports" for each user and dump into a csv.  I found some resources on the web but cannot find one that does the above.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
Use the following script below...
Import-module activedirectory
Get-AdUser -Filter * -Properties DisplayName, Title, Department, Manager |
Export-csv "c:\filename.csv" -nti

Open in new window

OasisEEAuthor Commented:
Hi will.  Thanks for answering so fast. What about the direct reports?
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
With PowerShell, the first step always is to get the correct cmdlet, in this case get-aduser. With that, the next step always is to get all properties and check which one you want:
get-aduser myuser -Properties * | fl *

Open in new window

In that list you should now see all available properties and their value, which helps in deciding whether it is the right one. You can also look at a restricted set, e.g. everything with "name" in it:
get-aduser myuser -Properties * | fl *name*

Open in new window

The command for everything but "Direct Reports" is
get-aduser -filter * -Properties * | select DisplayName, Title, Department, Manager | export-csv -NoType c:\results.csv

Open in new window

I cannot find anything that fits for "Direct Reports", that seems to be no standard AD attribute, but introduced by an AD Schema extension.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Will SzymkowskiSenior Solution ArchitectCommented:
Import-module activedirectory
Get-AdUser -Filter * -Properties DisplayName, Title, Department, Manager | Select DisplayName, Title, Department, Manager
Export-csv "c:\filename.csv" -nti

Open in new window

Unfortunately Direct Reports is not an attribute of Get-AdUser cmdlet.

I have modified the original script to add the select portion as I forgot to add this in the original.

If for some reason powershell is not working exactly as you would like. There is a native program that does exactly what you are asking for, CSVDE. It creates CSV files from AD data.
OasisEEAuthor Commented:
SquigglyMonkey, thank you, thats interesting and will take a look when I can.  However,

I have found a work around.  AD Tidy can be configured with columns that have Direct Reports (in AD tidy the column is called "managed accounts") as well as all the other information, which can then be outputted to CSV.

Here is the link:


Thank you all for your suggestions.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OasisEEAuthor Commented:
Well, this is kinda weird.  I get to rate myself.  In that case, A+! ;)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.