Export direct reports Attributes from List of Managers

New day, new PowerShell Magic….

One of the customer manger has contacted us  with the below requirement:

  • Export particular attributes for Direct reports from multiple managers.
  • Input will be provided via samacountnames of managers thru text file.

Attribute List:

Manager,FirstName, LastName, EmailAddress,Department, Location, Employeeid
We have used PowerShell Active Directory Module to achieve this as it has DirectReports attribute that we can loop thru.
Line 160 of Script:
$directrports = Get-ADUser -id $user -Properties directreports | Select -ExpandProperty directreports
Download/Install the script from PowerShell Gallery or from GitHub.
Install-Script -Name ExportADAttributesDirectReports
Once installed, you will be able to find the script in below location , you can run from there or copy it to some other location.
C:\Program Files\WindowsPowerShell\Scripts
Now when you run it, it will prompt you for the input text file which contains managers samaccountnames.
text file contents:
samaccountname1
samaccountname2
samaccountname3
samaccountname4
It will also create report and logs folder, report will be generated in CSV form and will be saved in report folder.
You can modify the script , add other attributes as per your requirement by updating the code between line 162 to 171.
I will upload the solution to Technet Script Gallery as well in coming week, as of now gallery is not opening correctly in browser and upload is not working.
Advertisement

2 thoughts on “Export direct reports Attributes from List of Managers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s