In the Organisation tab of a user object in Active Directory, you have the option to set who is the manager of a given user. While this may seem unnecessary, I have found it very useful when supporting a customer where I don’t know the reporting lines, as it gives me a one-stop place to go to find that information.
On occasion, I am asked to help audit this information, usually for a handful of managers. I have found the PowerShell function Get-ADDirectReports to be a useful tool for this. While the root function of finding this information for a single manager, by using the -Recurse parameter, we can get all direct and indirect reports for a given manager.
To run it for a single manager, the query is
Get-ADDirectReports -Identity Manager, while the query
Get-ADDirectReports -Identity Test_director -Recurse returns all direct and indirect reports.
By default, the output of the query is Name, SAMAccountName, Mail, and Manager, meaning that the latter example returns an overview of the entire organisation under a given manager,