Adding IP's to Office365 Tenant with PsExec

Modified on Wed, 25 Mar, 2020 at 10:38 PM

PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. You can learn more and download at https://docs.microsoft.com/en-us/sysinternals/downloads/psexec 


This is a PsExec script to modify connection filter to add the trusted IP addresses. This is required if you are going to use our service infront of Office365 or if you are doing a tenant migration. Without this tool the only other way to add IP's to Office365 is to copy/paste each one, which can be time consuming.

 

The content in quotes will be specific and custom to your tenant’s naming convention:


Inbound IP's (Required for Inbound Spam and Phishing Protection)


Set-HostedConnectionFilterPolicy "Inbound Connection Filter Policy" -IPAllowList 54.191.214.3,54.149.210.130,54.191.214.36,54.191.151.194,54.148.219.64,54.149.206.185,54.186.27.61,54.191.158.99,54.186.172.23,54.149.36.10,54.149.155.156,54.69.130.42,54.213.22.21,54.200.247.200,54.186.218.12,54.200.129.228,54.149.205.143,54.148.222.11,54.148.30.215,54.69.62.154,54.68.193.51,54.186.60.165,54.149.154.28,54.148.229.97,54.186.22.84,54.149.26.35,52.28.30.98,52.29.118.68,52.29.142.239,52.29.144.204,52.29.147.143,52.29.152.107,52.29.162.96,52.58.5.29,52.58.7.81,52.58.7.120,104.232.45.0/24

 

Please ensure that all of the IP's are added.


Outbound IP's (Unless you are smarthosting via our outbound system to your Tenant do not add these)


Set-HostedConnectionFilterPolicy "Outbound Connection Filter Policy" -IPAllowList 54.68.34.165,54.68.138.64,54.186.57.195,54.149.88.251,54.149.240.58,54.186.10.118,54.149.35.133,54.149.250.69,54.148.153.48,54.148.218.146,54.149.232.81,54.149.244.166,54.149.34.179,54.186.57.195,54.187.213.119,54.187.218.212,54.187.63.214,54.187.71.48,52.10.99.51,52.10.130.167,52.26.49.97,54.69.62.154,54.148.38.162,54.148.113.140,54.148.165.188,54.148.219.64,54.149.26.35,54.149.155.156,54.149.210.130,54.186.218.12,54.200.129.228,54.200.247.200,54.213.22.21,35.157.29.171,52.28.251.132,52.58.109.202,52.28.147.211,52.58.97.209,52.58.19.153,52.28.246.64,52.28.59.28,52.28.6.212,52.58.96.151,52.29.156.81,52.29.21.168,104.232.45.0/24




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article