File tree Expand file tree Collapse file tree
Modules/CIPPAlerts/Public/Alerts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ function Get-CIPPAlertQuotaUsed {
1515 $Threshold = if ($InputValue.QuotaUsedQuota ) { [int ]$InputValue.QuotaUsedQuota } else { 90 }
1616 $ExcludedRaw = Get-CIPPTextReplacement - TenantFilter $TenantFilter - Text ([string ]$InputValue.QuotaUsedExcludedMailboxes )
1717 $Excluded = @ ($ExcludedRaw -split ' ,' | ForEach-Object { $_.Trim ().ToLower() } | Where-Object { $_ })
18+ $MailboxTypes = @ ($InputValue.QuotaUsedMailboxTypes.value | Where-Object { $_ })
1819
1920 try {
2021 $AlertData = New-GraphGetRequest - uri " https://graph.microsoft.com/beta/reports/getMailboxUsageDetail(period='D7')?`$ format=application/json&`$ top=999" - tenantid $TenantFilter
@@ -27,8 +28,10 @@ function Get-CIPPAlertQuotaUsed {
2728 $OverQuota = $AlertData | ForEach-Object {
2829 if (! $_.StorageUsedInBytes -or ! $_.prohibitSendReceiveQuotaInBytes ) { return }
2930 if ($Excluded -contains $_.userPrincipalName.ToLower ()) { return }
31+ # Report returns 'User'/'Shared' or 'UserMailbox'/'SharedMailbox' depending on tenant; normalize before matching
32+ if ($MailboxTypes.Count -gt 0 -and ($_.recipientType -replace ' Mailbox$' ) -notin $MailboxTypes ) { return }
3033 $UsagePercent = [math ]::Round(($_.storageUsedInBytes / $_.prohibitSendReceiveQuotaInBytes ) * 100 )
31- if ($UsagePercent -gt $Threshold ) {
34+ if ($UsagePercent -ge $Threshold ) {
3235 [PSCustomObject ]@ {
3336 Message = " $ ( $_.userPrincipalName ) : Mailbox is more than $ ( $Threshold ) % full. Mailbox is $UsagePercent % full"
3437 Owner = $_.userPrincipalName
You can’t perform that action at this time.
0 commit comments