Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?
How?

share|improve this question

1 Answer 1

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" 
        }
    }
</ApiCall>
</Feature>
</Configuration>

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

 
discard

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.