Link to home
Start Free TrialLog in
Avatar of Mike Walker
Mike Walker

asked on

simple AD powershell script

Need powershell script to run through AD and export a csv of all users that have direct reports. I will be using the exported csv for an Exchange Distribution List.

I prefer to use raw powershell and no Quest plugins, vb scripts, etc.

This is to create a DL of supervisors and managers.
Avatar of Qlemo
Qlemo
Flag of Germany image

Can you elaborate on "of all users that have direct reports"? In general, you just run something like
Get-ADUser -Property a,b,c | ? { $_.a -like 'something*' } | Export-CSV -NoType C:\Temp\EE\ADUsers.csv

Open in new window

Avatar of Mike Walker
Mike Walker

ASKER

If there is a directreport listed for a person they will be added to the list. If there is no directreport for a person they will not be added to the list.
Sorry, I don't know how to understand "directreport". Is that a custom Active Directory attribute, maybe?
SOLUTION
Avatar of Kevin Stanush
Kevin Stanush
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I always use the ADInfo tool -- much simpler because you can adjust the query and you don't have to remember all those parameter attributes.
For a  simple export I agree, using some GUI tool is usually more satisfying ;-).
Thank you so much this is exactly what I was looking for.