Export (0) Print
Expand All

Get-MailContact

Applies to: Exchange Server 2010

Topic Last Modified: 2011-03-19

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


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


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

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 searched are:

  • CommonName (CN)
  • DisplayName
  • FirstName
  • LastName
  • Alias

Credential

Optional

System.Management.Automation.PSCredential

The Credential 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

The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that retrieves data from Active Directory.

Filter

Optional

System.String

The Filter parameter indicates the OPath filter used to filter recipients.

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

Identity

Optional

Microsoft.Exchange.Configuration.Tasks.MailContactIdParameter

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

  • ADObjectID
  • Distinguished name (DN)
  • LegacyExchangeDN
  • GUID
  • Domain\SamAccountName
  • User principal name (UPN)
  • E-mail address
  • 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 session and use the entire forest as the scope. This allows the command to access Active Directory objects that aren't currently in the default scope. Using the IgnoreDefaultScope parameter introduces the following restrictions:

  • You can't use the DomainController parameter. The command uses 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, aren't accepted.
  • You can't use the OrganizationalUnit and Identity parameters together.
  • You can't use the Credential parameter.

Organization

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationIdParameter

The Organization parameter is reserved for internal Microsoft use.

OrganizationalUnit

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

The OrganizationalUnit 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

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 you don't use this parameter, it's 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.

Bb124717.note(en-us,EXCHG.140).gifNote:
By default, the recipient scope is set to the domain that hosts your servers running Microsoft Exchange.

RecipientTypeDetails

Optional

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

The RecipientTypeDetails parameter specifies the type of recipients returned. Recipient types 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 that has 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.

You can select from the following values:

  • ArbitrationMailbox
  • ConferenceRoomMailbox
  • Contact
  • DiscoveryMailbox
  • DynamicDistributionGroup
  • EquipmentMailbox
  • ExternalManagedContact
  • ExternalManagedDistributionGroup
  • LegacyMailbox
  • LinkedMailbox
  • MailboxPlan
  • MailContact
  • MailForestContact
  • MailNonUniversalGroup
  • MailUniversalDistributionGroup
  • MailUniversalSecurityGroup
  • MailUser
  • PublicFolder
  • RoleGroup
  • RoomList
  • RoomMailbox
  • SharedMailbox
  • SystemAttendantMailbox
  • SystemMailbox
  • User
  • UserMailbox

ResultSize

Optional

Microsoft.Exchange.Data.Unlimited

The ResultSize 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

The SortBy 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.

The Get-MailContact 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.

You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you. To see what permissions you need, see the "Recipient Provisioning Permissions" section in the Mailbox Permissions topic.

Error Description

 

 

Exceptions Description

 

 

This example retrieves the mail-enabled contact named Arlene.

Get-MailContact -Identity Arlene | Format-List
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft