[O&M Master] How to whitelist domains in Office 365 by powershell
|
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:
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. |
| In detailed & informative article! |

Favorite (0)
