AntiMalware Status

List Direct Reports to Manager in PowerShell

Here is the task for today to use PowerShell. I was asked to find the list of employees under a specific manager. In Active Directory you can retrieve this information under the property DirectReports

Here is the one liner that will help you to get the information from Active Directory:

Get-ADUser -Identity **MANAGER** -Properties directreports | select-object -ExpandProperty DirectReports

or you can add more lines :

Import-Module ActiveDirectory
Write-Host . LIST DIRECT REPORTS . -ForegroundColor white -BackgroundColor red
$Manager = Read-Host [ Enter Manager User Name ]
Write-Host ... These are Direct Reports to $Manager -ForegroundColor yellow
Get-ADUser -Identity $Manager -Properties directreports | select-object -ExpandProperty DirectReports

Here we go now you can get list of all DirectReports employees to given Manager from Active Directory.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.