One request I’ve seen a lot over the years is to be able to customize the quota messages generated by the information store process. Customers have offered any number of reasons on why they want to do this - some for legal reasons can’t use PSTs, and some just want to give more helpful instructions to their users. To understand the problems with this, you have to understand how the Store process creates these messages.
Each night, during quota maintenance, the Information store kicks off a background task that walks through the mailbox table, checking the mailbox size against a user’s configured limits. A user falls into one of four categories by default:
- No limit
- Over warning limit
- Over send shutoff limit (QuotaExceeded)
- Over send receive shutoff limit (ShutoffQuotaExceeded)
The store creates a message (from the system attendant), and formats it using a string retrieved from MDBSZ.DLL (a compiled binary that is effectively part of the store). This string is formatted with a few predefined values, and the message is delivered via a system delivery path into the user’s inbox as a “quota message”. The key part here is that the source of data is a string resource in a compiled binary. MCS (Microsoft Consulting Services) will contract to update MDBSZ.DLL with a new string, but that has to be maintained, as each new Hotfix and service pack (and version) of Exchange will update MDBSZ.DLL.
For Exchange 2000 post SP3 & Exchange 2003 SP1, we have taken a DCR (design change request) to enable Administrators to create their own custom quota messages. Note that this does not mean editing the existing messages, or invoking that logic at all. The DCR is really three bits of functionality:
-
The first part of the DCR is a registry key that disables the system generated quota messages (similar to setting the quota maintenance to never). This registry key allows the event logs to still be generated, but the quota messages themselves are not delivered.
-
The second part of the DCR is a registry key that allows applications running as Local System to ignore quota settings (so you can save a message to a user’s inbox even if they are over the shutoff quota).
-
With the first two parts, everything is in place to allow people to write their own quota generation apps, but the process is not straightforward - An application (as LocalSystem) retrieves the mailbox table for the store (using methods documented in our SDKs) and walks along, looking at the quota status of each row. For each user over a limit, it then needs to retrieve the quota properties (off the user, then off the server if necessary) and then format and save a message. Note that I keep saying “Save”, not “Send”. We are not allowing users over their quotas to RECEIVE mail. Applications running as localsystem can save a message into the inbox. Still, the current method would require an AD trip per user, so we took a third part to the DCR - In the third part, the Store exposes new properties from the Mailbox Table that contain the quota information for the user.
So, now a custom app could be written that walked the mailbox table, looking at the status, using the quota information to format a custom message, and the over ride registry key to be able to save it into the inbox. This isn’t terribly complex code, but it didn’t exist. As part of testing this change, we needed an app that would do exactly that, so I wrote one. It began as a simple command line app (a derivative of the same tool I’ve modified to report mailbox sizes, repair OOFs, modify free/busy and other such things). I converted it to a service, added event logging, diagnostic logging, a RPC interface and a MMC extension to trigger it, and perfmon counters. The event logging and diagnostic code is inherited from a service I wrote for Exchange 5.5 that archived journaled email messages to SQL server for powerful searching. Custom messages can support inserts (%1, %2, %3, ect) for mailbox size, warning limit, send limit, send receive limit, and the difference between each.
You can download the service from http://workspaces.gotdotnet.com/quotamsgsvc. The source is available as well under a slightly modified Microsoft Shared Source License. The code as is worked at the last time I tested it, but my tests since converting to IExchangeManageStore4 (for supporting more than 64,000 mailboxes per server) have been limited.
Why release the source?
-
A quick download will show you that the service has a VERY manual setup. Manually merging reg files, manually loading perfmon counters. A rudimentary setup project is underway, but it’s no where near done.
-
Thresholds (the ability to deliver different messages at 10%, 15%, 25%, ect of quota are something the tool is designed to be able to do, but they aren’t done. Reports (copying the administrator or delivering a summary report) are not done.
-
There needs to be a way to exclude mailboxes. There isn’t.
-
Some people want to build a home grown mailbox manager app on top of this. So be it - there are KB articles telling you what properties Mailbox manager uses, and it would be easy to extend.
-
Some people want to archive messages to server based PSTs. That’s do-able too, there’s just no current code for it.
-
Some people insist on using additional inserts (%11, %12, ect) thinking that surely the documentation is wrong and there are hidden or secret information bits you can insert into a custom message. With the source, you can see for yourself what is available.
There’s a number of things that COULD be done, but I just don’t have time. While this has been a pet project of mine for a while, there’s no way this will satisfy what each and every user wants.
Limitations:
-
Exchange 2003 SP1 includes support for the extended props. When it ships, this will work against E2k3 servers.
-
This doesn’t do public folder messages. It’s not difficult do, but would require AD/GAL information that the current service doesn’t use.
-
Must have a mailbox on each server. Yup.
-
Not supported by Microsoft PSS. No, it isn’t. You have the code. If you have a problem, post on the workspace, or debug it yourself.
NOTE: The above note about lack of PSS support is no longer true. Microsoft Exchange Server Quota Message Service is now released on the official Exchange 2003 Tools web site and is now fully supported.
So, the workspace is open for business, the project and code are available for download.
Enjoy.
You Had Me at EHLO.