Skip to content

Commit fe773be

Browse files
Revert as reporting no longer worked correctly.
1 parent d7914ea commit fe773be

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

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

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,21 @@ function Invoke-CIPPStandardSendReceiveLimitTenant {
3737
return
3838
}
3939

40+
# Input validation
4041
if ([Int32]$Settings.ReceiveLimit -lt 1 -or [Int32]$Settings.ReceiveLimit -gt 150) {
4142
Write-LogMessage -API 'Standards' -tenant $tenant -message 'SendReceiveLimitTenant: Invalid ReceiveLimit parameter set' -sev Error
4243
return
4344
}
4445

46+
4547
$AllMailBoxPlans = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-MailboxPlan' | Select-Object DisplayName, MaxSendSize, MaxReceiveSize, GUID
46-
$MaxSendSize = "$($Settings.SendLimit)MB"
47-
$MaxReceiveSize = "$($Settings.ReceiveLimit)MB"
48-
$MaxSendSizeBytes = $Settings.SendLimit * 1MB
49-
$MaxReceiveSizeBytes = $Settings.ReceiveLimit * 1MB
48+
$MaxSendSize = [int64]"$($Settings.SendLimit)MB"
49+
$MaxReceiveSize = [int64]"$($Settings.ReceiveLimit)MB"
5050

5151
$NotSetCorrectly = foreach ($MailboxPlan in $AllMailBoxPlans) {
52-
if ($MailboxPlan.MaxSendSize -eq 'Unlimited') {
53-
$PlanMaxSendSize = [int64]::MaxValue
54-
} else {
55-
$PlanMaxSendSize = [int64]($MailboxPlan.MaxSendSize -replace '.*\(([\d,]+).*', '$1' -replace ',', '')
56-
}
57-
58-
if ($MailboxPlan.MaxReceiveSize -eq 'Unlimited') {
59-
$PlanMaxReceiveSize = [int64]::MaxValue
60-
} else {
61-
$PlanMaxReceiveSize = [int64]($MailboxPlan.MaxReceiveSize -replace '.*\(([\d,]+).*', '$1' -replace ',', '')
62-
}
63-
64-
if ($PlanMaxSendSize -ne $MaxSendSizeBytes -or $PlanMaxReceiveSize -ne $MaxReceiveSizeBytes) {
52+
$PlanMaxSendSize = [int64]($MailboxPlan.MaxSendSize -replace '.*\(([\d,]+).*', '$1' -replace ',', '')
53+
$PlanMaxReceiveSize = [int64]($MailboxPlan.MaxReceiveSize -replace '.*\(([\d,]+).*', '$1' -replace ',', '')
54+
if ($PlanMaxSendSize -ne $MaxSendSize -or $PlanMaxReceiveSize -ne $MaxReceiveSize) {
6555
$MailboxPlan
6656
}
6757
}
@@ -86,6 +76,7 @@ function Invoke-CIPPStandardSendReceiveLimitTenant {
8676
}
8777

8878
if ($Settings.alert -eq $true) {
79+
8980
if ($NotSetCorrectly.Count -eq 0) {
9081
Write-LogMessage -API 'Standards' -tenant $tenant -message "The tenant send($($Settings.SendLimit)MB) and receive($($Settings.ReceiveLimit)MB) limits are set correctly" -sev Info
9182
} else {

0 commit comments

Comments
 (0)