From cbdb31c7c582885b5acdbd03dc62268587d86719 Mon Sep 17 00:00:00 2001 From: DrIOS <58635327+DrIOSX@users.noreply.github.com> Date: Sat, 8 Jun 2024 11:54:54 -0500 Subject: [PATCH] add: better output to 1.1.3 --- source/tests/Test-GlobalAdminsCount.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/tests/Test-GlobalAdminsCount.ps1 b/source/tests/Test-GlobalAdminsCount.ps1 index e0188f4..0c71f28 100644 --- a/source/tests/Test-GlobalAdminsCount.ps1 +++ b/source/tests/Test-GlobalAdminsCount.ps1 @@ -15,15 +15,16 @@ function Test-GlobalAdminsCount { } process { - try { # 1.1.3 (L1) Ensure that between two and four global admins are designated # Retrieve global admin role and members $globalAdminRole = Get-MgDirectoryRole -Filter "RoleTemplateId eq '62e90394-69f5-4237-9190-012177145e10'" $globalAdmins = Get-MgDirectoryRoleMember -DirectoryRoleId $globalAdminRole.Id - $globalAdminCount = $globalAdmins.AdditionalProperties.Count - $globalAdminUsernames = ($globalAdmins | ForEach-Object { $_.AdditionalProperties["displayName"] }) -join ', ' + $globalAdminCount = $globalAdmins.Count + $globalAdminUsernames = ($globalAdmins | ForEach-Object { + "$($_.AdditionalProperties["displayName"]) ($($_.AdditionalProperties["userPrincipalName"]))" + }) -join ', ' # Prepare failure reasons and details based on compliance $failureReasons = if ($globalAdminCount -lt 2) {