Comments on: Finding Managers of Users with the Microsoft Graph PowerShell SDK https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/?utm_source=rss&utm_medium=rss&utm_campaign=find-manager-for-entra-id-account Mastering Office 365 and Microsoft 365 Wed, 07 Aug 2024 09:41:42 +0000 hourly 1 By: Peter Holdridge https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12641 Thu, 01 Aug 2024 13:26:07 +0000 https://office365itpros.com/?p=65761#comment-12641 In reply to Tony Redmond.

I forgot to mention. The main reason why we use the employeeType extension is because the Dynamic Rules in groups doesn’t include user.employeeType. Kind of a head scratcher why they haven’t included that.

]]>
By: Tony Redmond https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12629 Mon, 29 Jul 2024 14:59:56 +0000 https://office365itpros.com/?p=65761#comment-12629 In reply to Peter Holdridge.

Hah! We get this kind of thing all the time as we maintain the content of the Office 365 for IT Pros eBook…

]]>
By: Peter Holdridge https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12628 Mon, 29 Jul 2024 14:53:48 +0000 https://office365itpros.com/?p=65761#comment-12628 In reply to Tony Redmond.

I actually checked again and it appears to populate now after 2 years of using this script
Get-MgUser -UserId -Property employeetype |select employeetype

EmployeeType
————
Employee

]]>
By: Tony Redmond https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12627 Mon, 29 Jul 2024 14:49:42 +0000 https://office365itpros.com/?p=65761#comment-12627 In reply to Peter Holdridge.

Got it. Good reason!

]]>
By: Peter Holdridge https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12626 Mon, 29 Jul 2024 14:46:57 +0000 https://office365itpros.com/?p=65761#comment-12626 In reply to Tony Redmond.

It doesn’t populate from AD Connect so we have to use the extension.

]]>
By: Tony Redmond https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12624 Mon, 29 Jul 2024 14:05:10 +0000 https://office365itpros.com/?p=65761#comment-12624 In reply to Peter Holdridge.

There is an EmployeeType property. Is there any reason why you don’t use it?

]]>
By: Peter Holdridge https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12621 Mon, 29 Jul 2024 11:04:15 +0000 https://office365itpros.com/?p=65761#comment-12621 I agree, Entra is becoming a mess and it’s difficult to report for example who is registered for MFA, when the built-in report gives me Shared Mailboxes and other things.

For managers, we utilize EmployeeType property in AD (employee, contractor, service, etc).
I populate a group of just managers of employees & contractors.

$users = Get-MgUser -Filter “employeeId ne null” -all -ConsistencyLevel eventual -CountVariable CountVar
ForEach ($user in $users){
if (Get-MgUserDirectReport -UserId $user.id -All) {

$manager = $user
#get all direct reports
$allDirects = Get-MgUserDirectReport -UserId $manager.id -All

# add manager to manager array if the employeetype of the direct report is valid.
foreach ($direct in $allDirects) {
$employeeType = (Get-MgUser -UserId $direct.id -Property extension_72865f8793294a44b04f437101a06033_employeeType).additionalproperties.extension_72865f8793294a44b04f437101a06033_employeeType
if (($employeeType -eq “Employee”) -or ($employeeType -eq “Vendor”) -or ($employeeType -eq “Temp”) -or ($employeeType -eq “Contractor”)) {
$managers += $manager

# we only need to find one valid direct report, then we can move to the next manager.
break
}
}
}
}

I then compare the array to the existing group members and add or subtract if needed.
It takes about 10 min to run for 3000 users.

]]>
By: Tony Redmond https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12620 Mon, 29 Jul 2024 09:16:08 +0000 https://office365itpros.com/?p=65761#comment-12620 In reply to John Doe.

I believe that point is made in the article.

]]>
By: John Doe https://office365itpros.com/2024/07/29/find-manager-for-entra-id-account/#comment-12619 Mon, 29 Jul 2024 07:16:15 +0000 https://office365itpros.com/?p=65761#comment-12619 Not only utility accounts, but also rooms and equipment. All of them have associated user resource

]]>