Comments on: Generate a HTML Report of Managers and Direct Reports with the Graph SDK https://office365itpros.com/2023/04/06/entra-id-manager-direct-reports/?utm_source=rss&utm_medium=rss&utm_campaign=entra-id-manager-direct-reports Mastering Office 365 and Microsoft 365 Wed, 24 Jul 2024 20:30:30 +0000 hourly 1 By: Tony Redmond https://office365itpros.com/2023/04/06/entra-id-manager-direct-reports/#comment-10042 Fri, 07 Apr 2023 13:32:51 +0000 https://office365itpros.com/?p=59707#comment-10042 In reply to Tony Redmond.

I added these lines to remove the accounts used by room and shared mailboxes (the script also needs a Connect-ExchangeOnline command).

# The accounts used for Room and shared mailboxes can hold licenses (for example, for Teams Rooms Devices or to get a larger quota for a shared mailbox)
# so we remove these accounts here
$OriginalUserAccounts = $Users.Count
Write-Host “Finding Azure AD accounts used for shared and room mailboxes…”
[array]$NonUserAccounts = Get-ExoMailbox -RecipientTypeDetails SharedMailbox, RoomMailbox -ResultSize Unlimited | Select-Object UserPrincipalName, ExternalDirectoryObjectId
Write-Host “Removing non-user accounts from set to be processed…”
$Users = $Users | Where-Object {$_.Id -notin $NonUserAccounts.ExternalDirectoryObjectId}
$RemovedAccounts = $OriginalUserAccounts – $Users.Count
Write-Host (“Proceeding to process {0} user accounts after removing {1} room and shared mailbox accounts” -f $Users.Count, $RemovedAccounts)

]]>
By: Tony Redmond https://office365itpros.com/2023/04/06/entra-id-manager-direct-reports/#comment-10041 Fri, 07 Apr 2023 10:39:03 +0000 https://office365itpros.com/?p=59707#comment-10041 In reply to Peter.

“managers are not real humans”? Gosh, that’s a big statement to make…

]]>
By: Tony Redmond https://office365itpros.com/2023/04/06/entra-id-manager-direct-reports/#comment-10040 Fri, 07 Apr 2023 10:37:56 +0000 https://office365itpros.com/?p=59707#comment-10040 In reply to rialtus.

The point about Teams rooms devices and licensing is true. https://office365itpros.com/2023/03/29/teams-rooms-devices-licenses/

I shall think about how to filter those room mailboxes out…

]]>
By: rialtus https://office365itpros.com/2023/04/06/entra-id-manager-direct-reports/#comment-10037 Thu, 06 Apr 2023 15:50:57 +0000 https://office365itpros.com/?p=59707#comment-10037 “Finds user accounts with at least one assigned license. This step filters out accounts created for purposes like room and shared mailboxes.”

Well, it may filter out most of them. Microsoft Teams Rooms license (currently in Basic, Pro, and Premium flavors) is assigned to room mailboxes when you have in-room meeting hardware. There may also be service accounts with subscriptions that have a manager listed. As always, YMMV but this is a great starting point. Thanks Tony.

]]>
By: Peter https://office365itpros.com/2023/04/06/entra-id-manager-direct-reports/#comment-10035 Thu, 06 Apr 2023 12:08:48 +0000 https://office365itpros.com/?p=59707#comment-10035 Funny, I just happened to finish a script for this too.
1. Pulls users with an employeeID
2. If the “Get-MgUserDirectReport” returns “True”, I save all the direct reports in a variable.
3. I loop through the direct reports for that manager to verify at least one of them is employeType “Employee” or “Temp”. If it returns 1 result, it exits the loop for that manager and adds them to the manager group. Then goes to the next manager to check their direct reports. I check for employeeType because we assign managers to service accounts in AD but they are not real humans.
Takes like 10 minutes to run and finds 540 managers.
4) lastly, it removes any users from the group if the user isn’t in the result above.

]]>
By: Generate a HTML Report of Managers and Direct Reports with the Graph SDK – blog by @12Knocksinna – 365forall https://office365itpros.com/2023/04/06/entra-id-manager-direct-reports/#comment-10032 Thu, 06 Apr 2023 11:05:29 +0000 https://office365itpros.com/?p=59707#comment-10032 […] Report Azure AD Managers and Direct Reports with PowerShell (office365itpros.com) […]

]]>