-
Notifications
You must be signed in to change notification settings - Fork 1
/
ecsm-whitelist-ips.ps1
64 lines (59 loc) · 1.82 KB
/
ecsm-whitelist-ips.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
<#
.SYNOPSIS
Whitelist Exclaimer IPs via a Transport Rule
.DESCRIPTION
This script was created to resolve an issue with messages coming back from
our service being incorrectly identified as spam by Microsoft.
This workaround was provided as part of a Microsoft Premier Support Ticket
.NOTES
Email: [email protected]
Date: 15th August 2019
.PRODUCTS
Exclaimer Cloud - Signatures for Office 365
.REQUIREMENTS
Global Administrator access
Ability to connect to Office 365 via PowerShell
.HISTORY
1.0 - Commit of original script
#>
function basic-auth-connect {
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
}
function modern-auth-mfa-connect {
Import-Module ExchangeOnlineManagement
$upn = Read-Host ("Enter the UPN for your Global Administrator")
Connect-ExchangeOnline -UserPrincipalName $upn
}
function modern-auth-no-mfa-connect {
Import-Module ExchangeOnlineManagement
$LiveCred = Get-Credential
Connect-ExchangeOnline -Credential $LiveCred
}
$authtype = Read-Host ("Do you have basic auth enabled? Y/n")
If ($authtype -eq "y") {
basic-auth-connect
}
Else {
$mfa = Read-Host ("Do you have MFA enabled? Y/n")
if ($mfa -eq "y") {
modern-auth-mfa-connect
}
Else {
modern-auth-no-mfa-connect
}
}
New-TransportRule -Name "Bypass Spam for Exclaimer IP" `
-SenderIpRanges `
104.40.229.156,52.169.0.179,`
191.237.4.149,104.209.35.28,`
104.210.80.79,13.70.157.244,`
51.140.37.132,51.141.5.228,`
52.172.222.27,52.172.38.8,`
52.233.37.155,52.242.32.10,`
51.5.241.184,51.4.231.63 `
-SetSCL "-1" `
-Enabled $true `
-SenderAddressLocation Header -Priority 0