Processes in Microsoft 365 for setting up Office apps, redeeming product keys, and activating licenses.
Hello Asda3498,
Thanks for your post in this community.
Based on your requirement, we have checked from our end and found that with PowerShell cmdlet, we can specify multiple domains with separated by commas in “ExceptIfRecipientDomainIs” parameter. Kindly note you need to run this cmdlet for your all DLP policies individually. For this, first you need to collect identity details for your DLP compliance rule and once it collected you can add multiple domains in exception list. (Note: we recommend to first add two or three domains in your DLP exception list and once it’s success, you can go for all)
A. First all you need to connect to security and compliance PowerShell, for this process kindly check Connect to Security & Compliance Center PowerShell using the EXO V2 module | Microsoft Docs
Once it’s successfully connected, kindly run the below cmdlet:
B. Run the below cmdlet to get details about your all DLP policy and collect identity information.
- Get-DlpComplianceRule | fl
C. Once all identity details collected, use it in the below cmdlet and add your domains which you would like to add in your exception list. You need to specify multiple domains with separated by commas (in the below example, we have mention “xyz.com”, “aaa.com”)
- Set-DlpComplianceRule -Identity "xxxxx" -ExceptIfRecipientDomainIs "xyz.com", "aaa.com"
For your reference, here sharing our official documents for such PowerShell command Get-DlpComplianceRule (ExchangePowerShell) | Microsoft Docs and Set-DlpComplianceRule (ExchangePowerShell) | Microsoft Docs.
Thank you so much for your precious time. Stay safe and healthy.
Regards,
Ankita Vaidya