Skip to content

Commit b50118e

Browse files
Fix reporting
1 parent 7eba580 commit b50118e

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardExternalMFATrusted.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function Invoke-CIPPStandardExternalMFATrusted {
4343
# Input validation
4444
if (([string]::IsNullOrWhiteSpace($state) -or $state -eq 'Select a value') -and ($Settings.remediate -eq $true -or $Settings.alert -eq $true)) {
4545
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'ExternalMFATrusted: Invalid state parameter set' -sev Error
46-
Return
46+
return
4747
}
4848

4949
if ($Settings.remediate -eq $true) {
@@ -66,7 +66,8 @@ function Invoke-CIPPStandardExternalMFATrusted {
6666
}
6767
if ($Settings.report -eq $true) {
6868
$state = $ExternalMFATrusted.inboundTrust.isMfaAccepted ? $true : $ExternalMFATrusted.inboundTrust
69-
Set-CIPPStandardsCompareField -FieldName 'standards.ExternalMFATrusted' -FieldValue $ExternalMFATrusted.inboundTrust.isMfaAccepted -TenantFilter $Tenant
69+
$ReportState = $ExternalMFATrusted.inboundTrust.isMfaAccepted -eq $WantedState
70+
Set-CIPPStandardsCompareField -FieldName 'standards.ExternalMFATrusted' -FieldValue $ReportState -TenantFilter $Tenant
7071
Add-CIPPBPAField -FieldName 'ExternalMFATrusted' -FieldValue $ExternalMFATrusted.inboundTrust.isMfaAccepted -StoreAs bool -Tenant $Tenant
7172
}
7273

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardGroupTemplate.ps1

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function Invoke-CIPPStandardGroupTemplate {
2929
#>
3030
param($Tenant, $Settings)
3131
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'GroupTemplate'
32-
32+
$existingGroups = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/groups?$top=999' -tenantid $tenant
3333
if ($Settings.remediate -eq $true) {
3434
#Because the list name changed from TemplateList to groupTemplate by someone :@, we'll need to set it back to TemplateList
3535
$Settings.groupTemplate ? ($Settings | Add-Member -NotePropertyName 'TemplateList' -NotePropertyValue $Settings.groupTemplate) : $null
@@ -40,7 +40,7 @@ function Invoke-CIPPStandardGroupTemplate {
4040
$Filter = "PartitionKey eq 'GroupTemplate' and RowKey eq '$($Template.value)'"
4141
$groupobj = (Get-AzDataTableEntity @Table -Filter $Filter).JSON | ConvertFrom-Json
4242
$email = if ($groupobj.domain) { "$($groupobj.username)@$($groupobj.domain)" } else { "$($groupobj.username)@$($Tenant)" }
43-
$CheckExististing = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/groups?$top=999' -tenantid $tenant | Where-Object -Property displayName -EQ $groupobj.displayname
43+
$CheckExististing = $existingGroups | Where-Object -Property displayName -EQ $groupobj.displayname
4444
$BodyToship = [pscustomobject] @{
4545
'displayName' = $groupobj.Displayname
4646
'description' = $groupobj.Description
@@ -114,4 +114,22 @@ function Invoke-CIPPStandardGroupTemplate {
114114
}
115115
}
116116
}
117+
if ($Settings.report -eq $true) {
118+
$Groups = $Settings.groupTemplate.JSON | ConvertFrom-Json -Depth 10
119+
#check if all groups.displayName are in the existingGroups, if not $fieldvalue should contain all missing groups, else it should be true.
120+
$MissingGroups = foreach ($Group in $Groups) {
121+
$CheckExististing = $existingGroups | Where-Object -Property displayName -EQ $Group.displayname
122+
if (!$CheckExististing) {
123+
$Group.displayname
124+
}
125+
}
126+
127+
if ($MissingGroups.Count -eq 0) {
128+
$fieldValue = $true
129+
} else {
130+
$fieldValue = $MissingGroups -join ', '
131+
}
132+
133+
Set-CIPPStandardsCompareField -FieldName 'standards.SafeSendersDisable' -FieldValue $fieldValue -Tenant $Tenant
134+
}
117135
}

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardMailboxRecipientLimits.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ function Invoke-CIPPStandardMailboxRecipientLimits {
7171
$MailboxResults = @($Mailboxes) | ForEach-Object {
7272

7373
$Mailbox = $_
74-
#if the mailbox username contains a guid, we can assume it's a system mailbox and skip it
75-
if ($Mailbox.UserPrincipalName -match '^[^@]+@[^.]+\.[^.]+$') {
74+
if ($Mailbox.UserPrincipalName -like 'DiscoverySearchMailbox*' -or $Mailbox.UserPrincipalName -like 'SystemMailbox*') {
7675
return
7776
}
7877
# Safe hashtable lookup - check if MailboxPlanId exists and is not null

0 commit comments

Comments
 (0)