fix(exchange): mailboxes mode - null value error (#2739)
This commit is contained in:
parent
12eea0efd5
commit
606ac5397f
|
@ -104,19 +104,25 @@ try {
|
|||
$stat = get-mailboxStatistics -Identity $mailbox.Identity -ErrorAction SilentlyContinue
|
||||
if ($stat) {
|
||||
$size_bytes = $stat.TotalItemSize.Value.ToBytes()
|
||||
if ($null -ne $mailbox.ProhibitSendQuota -and $mailbox.ProhibitSendQuota.IsUnlimited -eq $false -and $size_bytes > $mailbox.ProhibitSendQuota.Value.ToBytes()) {
|
||||
if ($null -ne $mailbox.ProhibitSendQuota -and -not $mailbox.ProhibitSendQuota.IsUnlimited) {
|
||||
if ($size_bytes > $mailbox.ProhibitSendQuota.Value.ToBytes()) {
|
||||
$result.users.over_quota++
|
||||
$result.users.over_quota_details.Add($detail)
|
||||
} elseif ($null -ne $mailbox.ProhibitSendReceiveQuota -and $mailbox.ProhibitSendReceiveQuota.IsUnlimited -eq $false -and $size_bytes > $mailbox.ProhibitSendReceiveQuota.Value.ToBytes()) {
|
||||
}
|
||||
} elseif ($null -ne $mailbox.ProhibitSendReceiveQuota -and -not ($mailbox.ProhibitSendReceiveQuota.IsUnlimited)) {
|
||||
if ($size_bytes > $mailbox.ProhibitSendReceiveQuota.Value.ToBytes()) {
|
||||
$result.users.over_quota++
|
||||
$result.users.over_quota_details.Add($detail)
|
||||
} elseif ($null -ne $mailbox.issueWarningQuota -and $mailbox.issueWarningQuota.IsUnlimited -eq $false -and $size_bytes > $mailbox.issueWarningQuota.Value.ToBytes()) {
|
||||
}
|
||||
} elseif ($null -ne $mailbox.issueWarningQuota -and -not ($mailbox.issueWarningQuota.IsUnlimited)) {
|
||||
if ($size_bytes > $mailbox.issueWarningQuota.Value.ToBytes()) {
|
||||
$result.users.warning_quota++
|
||||
$result.users.warning_quota_details.Add($detail)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($mailbox in $folder_mailboxes) {
|
||||
$item = @{}
|
||||
|
@ -136,19 +142,25 @@ try {
|
|||
$stat = get-mailboxStatistics -Identity $mailbox.Identity -ErrorAction SilentlyContinue
|
||||
if ($stat) {
|
||||
$size_bytes = $stat.TotalItemSize.Value.ToBytes()
|
||||
if ($null -ne $mailbox.ProhibitSendQuota -and $mailbox.ProhibitSendQuota.IsUnlimited -eq $false -and $size_bytes > $mailbox.ProhibitSendQuota.Value.ToBytes()) {
|
||||
if ($null -ne $mailbox.ProhibitSendQuota -and -not ($mailbox.ProhibitSendQuota.IsUnlimited)) {
|
||||
if ($size_bytes > $mailbox.ProhibitSendQuota.Value.ToBytes()) {
|
||||
$result.public_folders.over_quota++
|
||||
$result.public_folders.over_quota_details.Add($detail)
|
||||
} elseif ($null -ne $mailbox.ProhibitSendReceiveQuota -and $mailbox.ProhibitSendReceiveQuota.IsUnlimited -eq $false -and $size_bytes > $mailbox.ProhibitSendReceiveQuota.Value.ToBytes()) {
|
||||
}
|
||||
} elseif ($null -ne $mailbox.ProhibitSendReceiveQuota -and -not ($mailbox.ProhibitSendReceiveQuota.IsUnlimited)) {
|
||||
if ($size_bytes > $mailbox.ProhibitSendReceiveQuota.Value.ToBytes()) {
|
||||
$result.public_folders.over_quota++
|
||||
$result.public_folders.over_quota_details.Add($detail)
|
||||
} elseif ($null -ne $mailbox.issueWarningQuota -and $mailbox.issueWarningQuota.IsUnlimited -eq $false -and $size_bytes > $mailbox.issueWarningQuota.Value.ToBytes()) {
|
||||
}
|
||||
} elseif ($null -ne $mailbox.issueWarningQuota -and -not ($mailbox.issueWarningQuota.IsUnlimited)) {
|
||||
if ($size_bytes > $mailbox.issueWarningQuota.Value.ToBytes()) {
|
||||
$result.public_folders.warning_quota++
|
||||
$result.public_folders.warning_quota_details.Add($detail)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$jsonString = $result | ConvertTo-JSON-20
|
||||
Write-Host $jsonString
|
||||
|
|
Loading…
Reference in New Issue