Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1
Topic Last Modified: 2010-04-27

Use the Get-Recipient cmdlet to return a list of recipient objects from the Active Directory directory service.

Syntax

get-Recipient [-Identity <RecipientIdParameter>] [-Credential <PSCredential>] [-DomainController <Fqdn>] [-IgnoreDefaultScope <SwitchParameter>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientType <RecipientType[]>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]
get-Recipient [-Credential <PSCredential>] [-DomainController <Fqdn>] [-IgnoreDefaultScope <SwitchParameter>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientPreviewFilter <String>] [-RecipientType <RecipientType[]>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]
get-Recipient [-Credential <PSCredential>] [-DomainController <Fqdn>] [-Filter <String>] [-IgnoreDefaultScope <SwitchParameter>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientType <RecipientType[]>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]
get-Recipient [-Anr <String>] [-Credential <PSCredential>] [-DomainController <Fqdn>] [-IgnoreDefaultScope <SwitchParameter>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientType <RecipientType[]>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]

Parameters

Parameter Required Type Description

Anr

Optional

System.String

The Anr parameter specifies a string on which to perform an ambiguous name resolution (ANR) search. You can specify a partial string and search for objects with an attribute that matches that string. The default attributes that are searched are:

  • CommonName (CN)

  • DisplayName (displayName)

  • FirstName (givenName)

  • LastName (sn)

  • Alias (mailNickname)

Credential

Optional

System.Management.Automation.PSCredential

The Credential parameter specifies the user name and password to use to access Active Directory.

If the Credential parameter is used, the command prompts for the account's password before continuing.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

To specify the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory, include the DomainController parameter in the command.

Filter

Optional

System.String

Use the Filter parameter to specify one or more attributes used to restrict the recipients that are returned by the query. This parameter cannot be used in conjunction with the Identity parameter or the Anr parameter.

For more information about the filterable properties, see Filterable Properties for the -Filter Parameter in Exchange 2007 RTM.

Identity

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter

The Identity parameter identifies the recipient. You can use one of the following values:

  • GUID

  • Domain\Account

  • User principal name (UPN)

  • LegacyExchangeDN

  • Simple Mail Transfer Protocol (SMTP) address

  • Name

  • Alias

IgnoreDefaultScope

Optional

System.Management.Automation.SwitchParameter

The IgnoreDefaultScope parameter instructs the command to ignore the default recipient scope setting for the Exchange Management Shell and use the entire forest as the scope. This allows the command to access Active Directory objects that are not currently in the default scope. Using the IgnoreDefaultScope parameter introduces the following restrictions:

  • You cannot use the DomainController parameter. The command will use an appropriate global catalog server automatically.

  • You can only use the DN for the Identity parameter. Other forms of identification, such as alias or GUID, are not accepted.

  • You cannot use the OrganizationalUnit and Identity parameters together.

  • You cannot use the Credential parameter.

OrganizationalUnit

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

The OrganizationalUnit parameter specifies an organizational unit (OU) or domain canonical name, and is used to limit the results. If you use this parameter, you get recipients in the container that you specify and objects in all child containers. For example:

  • OU: westcoast.contoso.com/users

  • Domain: westcoast.contoso.com

ReadFromDomainController

Optional

System.Management.Automation.SwitchParameter

The ReadFromDomainController parameter specifies that the user information is read from a domain controller in the user's domain. If you set the recipient scope to include all recipients in the forest, and if you do not use this parameter, it is possible that the user information is read from a global catalog with outdated information. If you use this parameter, multiple reads might be necessary to get the information.

Note:
By default, the recipient scope is set to the domain that hosts your Exchange servers.

RecipientPreviewFilter

Optional

System.String

Use the RecipientPreviewFilter parameter to specify a recipient filter that would define the recipients returned by this command. You can create a custom recipient filter for a dynamic distribution group, an address list, or an e-mail address policy. To verify that the recipient filter you specified will return the recipients you want, you can pass the OPATH filter specified in the RecipientFilter property for that dynamic distribution group, address list, or e-mail address policy to the RecipientPreviewFilter parameter and preview the list of recipients.

RecipientType

Optional

Microsoft.Exchange.Data.Directory.Recipient.RecipientType[]

The RecipientType parameter specifies the type of recipients to return. You can use one or more of the following types:

  • UserMailbox

  • MailUser

  • MailContact

  • MailUniversalDistributionGroup

  • MailUniversalSecurityGroup

  • MailNonUniversalGroup

  • DynamicDistributionGroup

  • PublicFolder

RecipientTypeDetails

Optional

Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails[]

The RecipientTypeDetails parameter specifies the type of recipients that are returned. Recipient types in Microsoft Exchange Server 2007 are divided into recipient types and subtypes. Each recipient type contains all common properties for all subtypes. For example, the type UserMailbox represents a user account in Active Directory with an associated mailbox. Because there are several mailbox types, each mailbox type is identified by the RecipientTypeDetails parameter. For example, a conference room mailbox has RecipientTypeDetails set to ConferenceRoomMailbox, whereas a user mailbox has RecipientTypeDetails set to UserMailbox.

For this command, the available recipient type details are:

  • ConferenceRoomMailbox

  • EquipmentMailbox

  • LegacyMailbox

  • LinkedMailbox

  • UserMailbox

  • MailContact

  • DynamicDistributionGroup

  • MailForestContact

  • MailNonUniversalGroup

  • MailUniversalDistributionGroup

  • MailUniversalSecurityGroup

  • MailUser

  • PublicFolder

  • SharedMailbox

ResultSize

Optional

Microsoft.Exchange.Data.Unlimited

The ResultSize parameter specifies the maximum number of results to return. If you want to return all recipients that match the filter, use "unlimited" for the value of this parameter. The default value is 1000.

SortBy

Optional

System.String

The SortBy parameter specifies the attribute by which to sort the results. You can sort by only one attribute at a time. You can sort by the following attributes:

  • Alias

  • DisplayName

  • Name

The results will be sorted in ascending order.

Detailed Description

The Get-Recipient cmdlet retrieves attributes of the specified recipient. No parameters are required. If the cmdlet is run without a parameter, a complete list of recipients for the organization is returned.

To run the Get-Recipient cmdlet, the account you use must be delegated the following:

  • Exchange View-Only Administrator role

For more information about permissions, delegating roles, and the rights that are required to administer Exchange Server 2007, see Permission Considerations.

Input Types

Return Types

Errors

Error Description

   

 

Exceptions

Exceptions Description

  

 

Example

The first example shows how to get information about all the recipients in your organization.

The second example shows how to get information about all the mail-enabled contacts in your organization, and sort them by name.

Copy Code
Get-Recipient -ResultSize unlimited
Get-Recipient -RecipientType MailContact -SortBy Name