Skip to content

Commit 67a642f

Browse files
committed
feat: PhishSimSpoofIntelligence replace switch
1 parent fd635b6 commit 67a642f

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

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

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ function Invoke-CIPPStandardPhishSimSpoofIntelligence {
3535

3636
[String[]]$AddDomain = $Settings.AllowedDomains.value | Where-Object { $_ -notin $DomainState.SendingInfrastructure }
3737

38-
$RemoveDomain = $DomainState | Where-Object { $_.SendingInfrastructure -notin $Settings.AllowedDomains.value } |
39-
Select-Object -Property Identity,SendingInfrastructure
38+
if ($Settings.RemoveExtraDomains -eq $true) {
39+
$RemoveDomain = $DomainState | Where-Object { $_.SendingInfrastructure -notin $Settings.AllowedDomains.value } |
40+
Select-Object -Property Identity,SendingInfrastructure
41+
} else {
42+
$RemoveDomain = @()
43+
}
4044

4145
$StateIsCorrect = ($AddDomain.Count -eq 0 -and $RemoveDomain.Count -eq 0)
4246

@@ -51,15 +55,17 @@ function Invoke-CIPPStandardPhishSimSpoofIntelligence {
5155
} Else {
5256
$BulkRequests = New-Object System.Collections.Generic.List[Hashtable]
5357

54-
# Prepare removal requests
55-
If ($RemoveDomain.Count -gt 0) {
56-
Write-Host "Removing $($RemoveDomain.Count) domains from Spoof Intelligence"
57-
$BulkRequests.Add(@{
58-
CmdletInput = @{
59-
CmdletName = 'Remove-TenantAllowBlockListSpoofItems'
60-
Parameters = @{ Identity = 'default'; Ids = $RemoveDomain.Identity }
61-
}
62-
})
58+
if ($Settings.RemoveExtraDomains -eq $true) {
59+
# Prepare removal requests
60+
If ($RemoveDomain.Count -gt 0) {
61+
Write-Host "Removing $($RemoveDomain.Count) domains from Spoof Intelligence"
62+
$BulkRequests.Add(@{
63+
CmdletInput = @{
64+
CmdletName = 'Remove-TenantAllowBlockListSpoofItems'
65+
Parameters = @{ Identity = 'default'; Ids = $RemoveDomain.Identity }
66+
}
67+
})
68+
}
6369
}
6470

6571
# Prepare addition requests

0 commit comments

Comments
 (0)