Indemnity83

Ramblings and musings of a technology addict

Archive for the ‘Script’ tag

Quickly Adjust Attachment Size Limits in Exchange 2007 & 2010

leave a comment

Inevitably the default attachment size limits in Exchange 2007 and 2010 end up being too small. I run into this all the time with Small Business Server 2008 and 2011 deployments where small businesses care more about being able to get all their email than the potential problems that large attachments can bring to enterprises deployments.

Changing the limits isn’t necessarily complicated, but there are a lot of places it needs to be changed to be effective. This gives enterprises a lot of power over message transactions, but can leave a sour taste in the mouth of any “computer dude” who’s primary job function is something other than managing the system. So in the interest of speeding up the process for myself and hopefully helping out a fellow I’ve written a very simple script that will update all the necessary limits for you. Simply copy/paste the below lines into a powershell (adjusting the initial variables as necessary) and away you go.

$MaxSend=”50MB”
$MaxRecieve=”50MB”
Set-TransportConfig –MaxSendSize $MaxSend –MaxReceiveSize $MaxRecieve
foreach ($rc in Get-ReceiveConnector) {Set-ReceiveConnector $rc.name –MaxMessageSize $MaxRecieve}
foreach ($sc in Get-SendConnector) {Set-SendConnector $sc.name –MaxMessageSize $MaxSend}
foreach ($mb in Get-Mailbox) {Set-Mailbox $mb.name –MaxSendSize unlimited –MaxReceiveSize unlimited}

This script is pretty global, very “blanket”. It’ll adjust all connectors without mercy to the size you specify, and will set all individual mailboxes to unlimited (which they should be already unless you’ve changed them). If you have any custom connectors you may have to go back and verify that they still meet your needs. If you are running a stock Small Business Server this script will end up changing the settings on the special connectors that are included as well, but it should be a safe change.

Finally, if you want to verify all the settings (or review them all before you start), you can issue the following lines to get an output of all the send and receive settings for all connectors on your system.

Get-TransportConfig | ft MaxSendSize, MaxReceiveSize
Get-ReceiveConnector | ft name, MaxMessageSize
Get-SendConnector | ft name, MaxMessageSize
Get-mailbox | ft Name, MaxSendSize, MaxReceiveSize

Written by Kyle

December 2nd, 2011 at 1:17 pm