Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Overview of this book

Table of Contents (22 chapters)
Microsoft Exchange 2010 PowerShell Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Applying retention policies to mailboxes


Retention policies are not automatically applied to end user mailboxes and must be set manually using either the Exchange Management Console or the Exchange Management Shell. In this recipe, you'll learn how to apply retention policies to mailboxes from the command line, which will be useful when performing a retention policy assignment on a large number of mailboxes, or on a regular basis as new mailboxes are created.

How to do it...

  1. To apply a retention policy to a mailbox, you use the Set-Mailbox cmdlet, specifying the retention policy name using the -RetentionPolicy parameter. For example, to do this for one user, the command would look something like this:

    Set-Mailbox dsmith -RetentionPolicy AllUsers
  2. In addition, you may need to perform this operation on all mailboxes at once. In this case, you could use the following syntax:

    Get-Mailbox -RecipientTypeDetails UserMailbox | 
      Set-Mailbox -RetentionPolicy AllUsers

How it works...

Retention policies...