Skip to content

Commit 65c48fc

Browse files
committed
Filter tenants using Get-Tenants in report scripts
Updated Get-CIPPMFAStateReport and Get-CIPPMailboxPermissionReport to filter tenants based on the defaultDomainName property from Get-Tenants with -IncludeErrors. This ensures only valid tenants are processed in the reports.
1 parent f97cb87 commit 65c48fc

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Modules/CIPPCore/Public/Get-CIPPMFAStateReport.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ function Get-CIPPMFAStateReport {
2727
$AllMFAItems = Get-CIPPDbItem -TenantFilter 'allTenants' -Type 'MFAState'
2828
$Tenants = @($AllMFAItems | Where-Object { $_.RowKey -ne 'MFAState-Count' } | Select-Object -ExpandProperty PartitionKey -Unique)
2929

30+
$TenantList = Get-Tenants -IncludeErrors
31+
$Tenants = $Tenants | Where-Object { $TenantList.defaultDomainName -contains $_ }
32+
3033
$AllResults = [System.Collections.Generic.List[PSCustomObject]]::new()
3134
foreach ($Tenant in $Tenants) {
3235
try {

Modules/CIPPCore/Public/Get-CIPPMailboxPermissionReport.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ function Get-CIPPMailboxPermissionReport {
3939
$AllMailboxItems = Get-CIPPDbItem -TenantFilter 'allTenants' -Type 'Mailboxes'
4040
$Tenants = @($AllMailboxItems | Where-Object { $_.RowKey -ne 'Mailboxes-Count' } | Select-Object -ExpandProperty PartitionKey -Unique)
4141

42+
$TenantList = Get-Tenants -IncludeErrors
43+
$Tenants = $Tenants | Where-Object { $TenantList.defaultDomainName -contains $_ }
44+
4245
$AllResults = [System.Collections.Generic.List[PSCustomObject]]::new()
4346
foreach ($Tenant in $Tenants) {
4447
try {

0 commit comments

Comments
 (0)