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.
OasisEEAsked:
Who is Participating?
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


Will.
0
OasisEEAuthor Commented:
Hi will.  Thanks for answering so fast. What about the direct reports?
0
QlemoBatchelor, 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.
0
ON-DEMAND: 10 Easy Ways to Lose a Password

Learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees in this on-demand webinar. We cover the importance of multi-factor authentication and how these solutions can better protect your business!

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.

Will.
0
SquigglyMonkeyCommented:
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.
0
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:

http://www.cjwdev.co.uk/Software.html

Thank you all for your suggestions.
0

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+! ;)
0
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.

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.