Skip to content

Commit

Permalink
Formatting and move variable up
Browse files Browse the repository at this point in the history
  • Loading branch information
kris6673 committed Apr 2, 2024
1 parent bb92e7b commit f5aa743
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ function Invoke-CIPPStandardAntiPhishPolicy {
#>

param($Tenant, $Settings)
$PolicyName = 'Default Anti-Phishing Policy'
$AntiPhishPolicyState = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AntiPhishPolicy' |
Where-Object -Property Name -eq $PolicyName |
Select-Object Name, Enabled, PhishThresholdLevel, EnableMailboxIntelligence, EnableMailboxIntelligenceProtection, EnableSpoofIntelligence, EnableFirstContactSafetyTips, EnableSimilarUsersSafetyTips, EnableSimilarDomainsSafetyTips, EnableUnusualCharactersSafetyTips, EnableUnauthenticatedSender, EnableViaTag, MailboxIntelligenceProtectionAction, MailboxIntelligenceQuarantineTag
Where-Object -Property Name -EQ $PolicyName |
Select-Object Name, Enabled, PhishThresholdLevel, EnableMailboxIntelligence, EnableMailboxIntelligenceProtection, EnableSpoofIntelligence, EnableFirstContactSafetyTips, EnableSimilarUsersSafetyTips, EnableSimilarDomainsSafetyTips, EnableUnusualCharactersSafetyTips, EnableUnauthenticatedSender, EnableViaTag, MailboxIntelligenceProtectionAction, MailboxIntelligenceQuarantineTag

$PolicyName = "Default Anti-Phishing Policy"
$StateIsCorrect = if (
($AntiPhishPolicyState.Name -eq $PolicyName) -and
($AntiPhishPolicyState.Enabled -eq $true) -and
Expand All @@ -32,28 +32,28 @@ function Invoke-CIPPStandardAntiPhishPolicy {
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Anti-phishing Policy already exists.' -sev Info
} else {
$cmdparams = @{
Enabled = $true
PhishThresholdLevel = $Settings.PhishThresholdLevel
EnableMailboxIntelligence = $true
Enabled = $true
PhishThresholdLevel = $Settings.PhishThresholdLevel
EnableMailboxIntelligence = $true
EnableMailboxIntelligenceProtection = $true
EnableSpoofIntelligence = $true
EnableFirstContactSafetyTips = $Settings.EnableFirstContactSafetyTips
EnableSimilarUsersSafetyTips = $Settings.EnableSimilarUsersSafetyTips
EnableSimilarDomainsSafetyTips = $Settings.EnableSimilarDomainsSafetyTips
EnableUnusualCharactersSafetyTips = $Settings.EnableUnusualCharactersSafetyTips
EnableUnauthenticatedSender = $true
EnableViaTag = $true
EnableSpoofIntelligence = $true
EnableFirstContactSafetyTips = $Settings.EnableFirstContactSafetyTips
EnableSimilarUsersSafetyTips = $Settings.EnableSimilarUsersSafetyTips
EnableSimilarDomainsSafetyTips = $Settings.EnableSimilarDomainsSafetyTips
EnableUnusualCharactersSafetyTips = $Settings.EnableUnusualCharactersSafetyTips
EnableUnauthenticatedSender = $true
EnableViaTag = $true
MailboxIntelligenceProtectionAction = $Settings.MailboxIntelligenceProtectionAction
MailboxIntelligenceQuarantineTag = $Settings.MailboxIntelligenceQuarantineTag
MailboxIntelligenceQuarantineTag = $Settings.MailboxIntelligenceQuarantineTag
}

try {
if ($AntiPhishPolicyState.Name -eq $PolicyName) {
$cmdparams.Add("Identity", $PolicyName)
$cmdparams.Add('Identity', $PolicyName)
New-ExoRequest -tenantid $Tenant -cmdlet 'Set-AntiPhishPolicy' -cmdparams $cmdparams
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Updated Anti-phishing Policy' -sev Info
} else {
$cmdparams.Add("Name", $PolicyName)
$cmdparams.Add('Name', $PolicyName)
New-ExoRequest -tenantid $Tenant -cmdlet 'New-AntiPhishPolicy' -cmdparams $cmdparams
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Created Anti-phishing Policy' -sev Info
}
Expand Down

0 comments on commit f5aa743

Please sign in to comment.