[O&M Master] How to whitelist domains in Office 365 by powershell

sazzad
sazzad  Silver  (1)
5 years 7 months ago  View: 2902  Reply: 4
1F

The first step in this process is to create a plain text file with a domain on each line that you would like to white-list. If you enter a full email address the script will strip the part in front of the @symbol and white-list the entire domain.

So your list might look something like:

 

nicedomain.com
trusteddomain.com
tachytelic.net
accendo.co.uk
testemailaddress@somedomain.com 

The final line in this example of “testemailaddress@somedomain.com” will be stripped down to “somedomain.com”, I added this because the list I was supplied with contained some full email addresses which the transport rule cannot accept. Each line is also trimmed of white-space to ensure the rule creation is successful.

Once you have your file in place you need to connect to Exchange Online using Remote Powershell. Instructions on how to do that here:

Windows PowerShell needs to be configured to run scripts, and by default, it isn't. You get the following error when you try to connect:

Files cannot be loaded because running scripts is disabled on this system. Provide a valid certificate with which to sign the files.

To enable Windows PowerShell to run signed scripts, run the following command in an elevated Windows PowerShell window (a Windows PowerShell window you open by selecting Run as administrator):

 

Set-ExecutionPolicy RemoteSigned

You need to configure this setting only once on your computer, not every time you connect.

 

user_2789677
user_2789677  Medium 
5 years 7 months ago
2F
In detailed & informative article!
sazzad
sazzad  Silver 
5 years 7 months ago
3F
Posted by user_2789677 at 2016-08-27 13:47 In detailed & informative article!
I am glad that you liked it!
sazzad
sazzad  Silver 
5 years 7 months ago
4F
Let me know guys if you need to know anything else which i can discuss or may be i will make new post considering those topics.
Tamanna
Tamanna  Junior 
5 years 7 months ago
5F
Good Article