You want to block incoming attachment types in Microsoft Exchange 2010.
There are many reasons one may want to block specific file types from getting onto their email server. There are also many ways to complete this task. If you’re running Exchange in a box – one server for CAS, Transport and Mailbox – perhaps the easiest way to pull this off is to use Transport Rules.
In this example we’ll block Attachments containing .zip files.
First, we’ll setup a rule via Exchange Management Console:
- Launch the Exchange Management Console, Expand the Organization Configuration tree, Select Hub Transport and Click New Transport Rule… in the Actions pane.
- Give the rule a descriptive name, comment if you like, and click Next
- Now you’ll see all of the conditions that can be applied to incoming email, for Step 1: scroll down the list until you reach: when any attachment file name matches text patterns
There should now be an entry in Step 2:. Click text patterns
- You define the match that Exchange will look for when a new email comes in via the Text patterns: field. Since we’re presently only trying to block .zip files, leave out the quotes and enter the following string: ” *.zip” BE AWARE of the leading space in that string, it must be in there.
- Click OK and Click Next
- Now that we’ve defined what Exchange is looking for, we need to tell Exchange what to do once the rule has a match. In my test case, I will just simply tell Exchange to Delete the message without notifying anyone, which is the last option. Click Next once you selected the Action that will be taken.
- The third and final configuration window is exceptions. The rule to this point is extremely broad, this is where you can allow that one user in accounting to receive .zip files. There are a lot of options here, when you’ve finished making exceptions or don’t need any, click Next.
- Click New and Click Finish
Here’s the same rule via Exchange Shell:
- From the Exchange Shell, paste the following command:
New-TransportRule -Name 'Block All .ZIP Attachments' -Priority '0' -Enabled $true -AttachmentNameMatchesPatterns ' *.zip' -DeleteMessage $true