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

Use the Get-Contact cmdlet to retrieve information on a specified contact or contacts.

Syntax

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

Parameters

Parameter Required Type Description

Anr

Optional

System.String

The Anr parameter is used to search for objects that match a partial string that is provided. It is similar to a search using wildcard characters.

Credential

Optional

System.Management.Automation.PSCredential

The Credential parameter specifies the account used to query Active Directory for the contact's credentials.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

To specify the fully qualified domain name (FQDN) of the domain controller that retrieves data from Active Directory, include the DomainController parameter in the command.

Filter

Optional

System.String

The Filter parameter specifies a set of attributes that is used to restrict the recipients that are returned by the query.

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

Identity

Optional

Microsoft.Exchange.Configuration.Tasks.ContactIdParameter

The Identity parameter takes one of the following values:

  • GUID

  • Distinguished name (DN)

  • Domain\Account

  • User principal name (UPN)

  • LegacyExchangeDN

  • Simple Mail Transfer Protocol (SMTP) 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 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 returns objects from the specified organizational unit (OU) and objects in all child containers.

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.

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:

  • Contact

  • MailEnabledContact

  • MailEnabledForestContact

ResultSize

Optional

Microsoft.Exchange.Data.Unlimited

The ResultSize parameter specifies the maximum number of results to return.

SortBy

Optional

System.String

The SortBy parameter specifies to sort by a single attribute in ascending order.

Detailed Description

The Get-Contact cmdlet queries the properties of a specific contact or contact recipient objects in the Active Directory directory service.

To run the Get-Contact 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

In this example, the Get-Contact command retrieves the contact Ted Bremer and pipelines the object to the Format-List command to display the information about the contact.

Copy Code
Get-Contact -Identity TedBremer | Format-List