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

Working with recipient filters


Starting with Exchange 2007 and continuing with Exchange 2010, address lists, dynamic distribution groups, e-mail address policies, and global address lists can be customized with recipient filters that use OPATH filtering syntax. This replaces the LDAP filtering syntax that was used in earlier versions of Exchange. We can also perform server-side searches using filters, which can greatly speed up our work. In this recipe, you'll learn how to work with these filters in the Exchange Management Shell.

How to do it...

  1. We can filter the results from the recipient Get-* cmdlets using the -Filter parameter:

    Get-Mailbox -Filter {Office -eq 'Sales'}
  2. In addition, we can use attribute filters to create distribution groups, e-mail address policies, and address lists using the -RecipientFilter parameter:

    New-DynamicDistributionGroup -Name DL_Accounting `
    -RecipientFilter {
      (Department -eq 'Accounting') -and 
      (RecipientType -eq 'UserMailbox')
    }

How it works...

In our first...