0

I'm looking to create an Office 365 transport rule to allow inbound emails from selected IP addresses to bypass the spam filter.

Can someone please help?

The closest I've been able to come up with is:

Set-TransportRule -Name "Whitelist" -ExceptIfSenderIpRanges {1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4} -SetSCL -1

Thanks for your help!

Ash
  • 448
  • 2
  • 9
  • 31
  • Something like this? `$ips =@("1.1.1.1","2.2.2.2") foreach ($ip in $ips){Set-TransportRule -Name "Whitelist" -ExceptIfSenderIpRanges $ip -SetSCL -1}` – Smeerpijp Dec 14 '17 at 10:20
  • Thanks for your help. Running these commands shows error: Starting a command on the remote server failed with the following error message : The I/O operation has been aborted because of either a thread exit or an application request. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OperationStopped: (outlook.office365.com:String) [], PSRemotingTransportException + FullyQualifiedErrorId : JobFailure + PSComputerName : outlook.office365.com – Ash Dec 14 '17 at 23:30

3 Answers3

1

CSV file:

enter image description here

Cmdlet:

$IPs = Import-Csv C:\root\IP.CSV
$IpRange =$IPs.IP
Get-TransportRule  <Rule Name> | Set-TransportRule -ExceptIfSenderIpRanges $IPRange
Get-TransportRule  <Rule Name>  |fl  ExceptIfSenderIpRanges

Figure as below: enter image description here

Jianfei Wang
  • 387
  • 1
  • 4
0
$UserCredential = Get-Credential
Set-ExecutionPolicy RemoteSigned
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Get-Mailbox
Get-Mailbox | Set-MailboxJunkEmailConfiguration –Enabled $False
Colt
  • 1,939
  • 6
  • 20
  • 25
-1

We can do it by Content Filter setting or Transport rule. For your reference: How to Whitelist by IP Address in Exchange 2013, 2016, or Office 365

Jianfei Wang
  • 387
  • 1
  • 4
  • I understand how to do it via the Exchange Admin Center, however this process only allows to add one IP address at a time. I have to add 83 IP addresses per Office 365 tenant for about 10 tenants, therefore am looking for a PowerShell command. – Ash Dec 14 '17 at 05:01
  • Well, I suppose that there's a csv file for those IP addresses. If so, we can do it by command. Check it in my new reply. – Jianfei Wang Dec 18 '17 at 04:26