If you execute the Get-CmdletExtensionAgent cmdlet on an Exchange 2010 server and then select the name of the output objects, you’ll see something like this:
Cmdlet extension agents are a new feature of Exchange 2010. They are designed to extend the processing performed by standard cmdlets. The two best examples that I can cite are the Admin Audit Log agent, which captures details of administrative events if you enable logging with a command like this:
Set-AdminAuditLogConfig -AdminAuditLogEnabled $True
The other example is the Mailbox Resources Management Agent. This serves a really useful purpose in that it scans for new mailbox requests that don’t have a database specified (in other words, an administrator wants Exchange to decide in which database the new mailbox will be located). The agent scans for healthy databases in the site where the command is run and then omits any databases that are excluded from automatic mailbox provisioning to create a set that can host the new mailbox. It then selects a database at random and the new mailbox is created there. There’s no great intelligence exhibited in how the choice of database is made and a database that already has 1,000 mailboxes might be chosen as often as a newly-created database that only has a few mailboxes. The Mailbox Resources Management agent also takes care of selecting a suitable database for an archive mailbox, if you decide to separate the primary and archive mailboxes (but only in SP1).
The standard set of cmdlet extension agents clearly do useful work for Exchange 2010, but even better, you can create your own extensions and have Exchange execute them according to conditions that you state. This ability depends on the Scripting Agent, one of the standard set of cmdlet extensions, but also the only one of the standard set that is disabled by default. You can see the details of the Scripting Agent with:
Get-CmdletExtensionAgent -Identity "Scripting Agent" | Format-Table Name, Enabled, Priority
and enable it after you’re sure that it is disabled with:
Enable-CmdletExtensionAgent -Identity "Scripting Agent"
After that, you can begin to write your own code and have Exchange execute it before or after standard cmdlets such as New-Mailbox are run by administrators through EMS, EMC, or ECP. I won’t duplicate a blog post to tell you how here as there’s an excellent description already written by Pat Richard and posted on his blog
More stuff to stuff into the book, if I get to it… Time is marching on, the editors are getting antsy, and the presses must soon start turning.
On the other hand, it’s an example of the great kind of content that we can dive into during our three-day seminars in October Exchange 2010 Maestro seminars.
Learn more about the changes made to cmdlets in Exchange 2010 including more detail about cmdlet extension agents in my Exchange Server 2010 Inside Out book.