Dela via


Get-MailContact

 

Applies to: Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3

Use the Get-MailContact cmdlet to retrieve all of the specified contact's attributes from Active Directory.

Syntax

Get-MailContact [-Identity <MailContactIdParameter>] [-Credential <PSCredential>] [-DomainController <Fqdn>] [-IgnoreDefaultScope <SwitchParameter>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]

Get-MailContact [-Credential <PSCredential>] [-DomainController <Fqdn>] [-Filter <String>] [-IgnoreDefaultScope <SwitchParameter>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]

Get-MailContact [-Anr <String>] [-Credential <PSCredential>] [-DomainController <Fqdn>] [-IgnoreDefaultScope <SwitchParameter>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]

Detailed Description

This cmdlet retrieves all attributes of the specified contact. No parameters are required. If the cmdlet is run without a parameter, a complete list of contacts for the Exchange organization is returned.

To run the Get-MailContact 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 Microsoft Exchange Server 2007, see Permission Considerations.

Parameters

Parameter Required Type Description

ANR

Optional

System.String

The specified parameter is resolved by using ambiguous name resolution (ANR). The default attributes searched are:

  • CommonName (CN)

  • DisplayName (displayName)

  • FirstName (givenName)

  • LastName (sn)

  • Alias (mailNickname)

  • LegacyExchangeDN (legacyExchangeDN)

  • Name (name) (instead of CommonName/CN)

  • EmailAddresses (proxyAddresses)

  • SamAccountName (samAccountName)

  • Office (physicalDeliveryOfficeName)

Credential

Optional

System.Management.Automation.PSCredential

This parameter specifies the account to use to gain access to 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 of the domain controller that retrieves data from Active Directory, include the DomainController parameter in the command.

Filter

Optional

System.String

This parameter is used to filter the list of recipients returned. You can specify the attributes to filter.

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

Identity

Optional

Microsoft.Exchange.Configuration.Tasks.MailContactIdParameter

This parameter identifies the contact. You can include the contact's ADObjectID, distinguished name, LegacyExchangeDN, GUID, Domain\SamAccountName, user principal name (UPN), e-mail address, or alias.

OrganizationalUnit

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

This parameter specifies a container in which to limit the results. Either an organizational unit (OU) or a domain can be specified. Also, the canonical name should be specified. For example:

  • OU: westcoast.contoso.com/users

  • Domain: westcoast.contoso.com

The OrganizationalUnit parameter returns objects from the specified organizational unit (OU) and objects in all child containers.

ReadFromDomainController

Optional

System.Management.Automation.SwitchParameter

This 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.

RecipientTypeDetails

Optional

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

The RecipientTypeDetails parameter specifies the type of recipients that are returned. Recipient types in Exchange 2007 are broken down 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 cmdlet, the available recipient type details are:

  • MailEnabledContact

  • MailEnabledForestContact

ResultSize

Optional

Microsoft.Exchange.Data.Unlimited

This parameter specifies the total number of recipient objects to return. If not specified, the parameter returns all results that match the filter.

SortBy

Optional

System.String

This parameter specifies the attribute by which to sort the results. Sorting is performed one attribute at a time and is always performed in ascending order.

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.

Input Types

Return Types

Errors

Error Description

Exceptions

Exceptions Description

Example

In this example, the Get-MailContact command is used to retrieve the mail-enabled contact named Ted.

Get-MailContact -Identity Ted | Format-List