Jump to content

Recommended Posts

Posted

Hi

We are a MAT, currently with 9 schools. We use M365, with each school having its own email domain. We'd like to prevent students in one school from email students in another school, but to allow students within the same school to email between themselves.

We're trying to create some structured rules within M365/Exchange to configure this, but without having to have a myriad of individual rules for each school.

I'm sure we can't be the only MAT to need to do this. Can anyone point us in the right direction?

Posted (edited)

Thanks guys. A colleague did some research and wrote the following PowerShell command which he ran through the Exchange online PowerShell module.

 

New-TransportRule "Block student inter-school comms" -SenderADAttributeMatchesPatterns "userPrincipalName: [0-9]+@[A-Za-z0-9]+-xxx\.xx" -ExceptIfADComparisonAttribute Company -RejectMessageReasonText "Messaging students outside your school is prohibited."

 

The above command does the following -

-Creates a new transport rule called - "Block student inter-school comms"

-The rule checks that the sender is a student by matching their userPrincipleName to the following a RegEx matching our students username format

-The rule then checks if the sender and recipient have different values in the "company" attribute that match our school codes

-If the sender and recipient have the same "company" attribute value, the message is delivered

-If the sender and recipient have the different "company" attribute values, the message is rejected with the message: "Messaging students outside your school is prohibited."

Edited by steven_layton_sl

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...