Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a retention policy in Exchange 2010 (SP2), apply it to all existing mailboxes (and this is easy), and then have it automatically applied to all new mailboxes.

Is this possible?

share|improve this question
up vote 1 down vote accepted

You can write a script and run it daily (get a list of all mailboxes without a retention policy) or use a cmdlet extension agent to detect when mailbox is created and automatically assign a rentention policy (don't have access to exchange 2010 atm so can't really test it):

<?xml version="1.0" encoding="utf-8" ?>
<Configuration version="1.0">
<Feature Name="MailboxProvisioning" Cmdlets="new-mailbox">
<ApiCall Name="OnComplete">
    if($succeeded)    {
        $mbx = get-mailbox | where{!$_.RetentionPolicy} 
        foreach($mb in $mbx){
            Set-Mailbox –RetentionPolicy "foo" 

or only for this mailbox:

if($succeeded)    {
    $Name= $provisioningHandler.UserSpecifiedParameters["Name"] 
    if($provisioningHandler.UserSpecifiedParameters["RetentionPolicy"] -eq $null){ 
    Set-Mailbox -Identity $Name -RetentionPolicy "foo" 
share|improve this answer
I was fearing this. The extension agent looks better than a scheduled script, though. – Massimo Dec 6 '12 at 14:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.