From e8e07cf7c124b40f236ace568af506da1b17cec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Kj=C3=A6rg=C3=A5rd?= Date: Wed, 23 Oct 2024 21:32:23 +0200 Subject: [PATCH] Small change to make it easier to add exclusions in the future --- .../Push-DomainAnalyserTenant.ps1 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Domain Analyser/Push-DomainAnalyserTenant.ps1 b/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Domain Analyser/Push-DomainAnalyserTenant.ps1 index 203428ec580e..fee6bc66b2c1 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Domain Analyser/Push-DomainAnalyserTenant.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Domain Analyser/Push-DomainAnalyserTenant.ps1 @@ -20,7 +20,24 @@ function Push-DomainAnalyserTenant { return } else { try { - $Domains = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/domains' -tenantid $Tenant.customerId | Where-Object { ($_.id -notlike '*.microsoftonline.com' -and $_.id -NotLike '*.exclaimer.cloud' -and $_.id -Notlike '*.excl.cloud' -and $_.id -NotLike '*.codetwo.online' -and $_.id -NotLike '*.call2teams.com' -and $_.id -notlike '*signature365.net' -and $_.isVerified) } + # Remove domains that are not wanted, and used for cloud signature services + $ExclusionDomains = @( + '*.microsoftonline.com' + '*.exclaimer.cloud' + '*.excl.cloud' + '*.codetwo.online' + '*.call2teams.com' + '*signature365.net' + ) + $Domains = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/domains' -tenantid $Tenant.customerId | Where-Object { $_.isVerified -eq $true } | ForEach-Object { + $Domain = $_ + foreach ($ExclusionDomain in $ExclusionDomains) { + if ($Domain.id -like $ExclusionDomain) { + $Domain = $null + } + } + $Domain + } | Where-Object { $_ -ne $null } $TenantDomains = foreach ($d in $Domains) { [PSCustomObject]@{