Get-User (RTM)

Microsoft Exchange Server 2007 will reach end of support on April 11, 2017. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.

 

Applies to: Exchange Server 2007

Use the Get-User cmdlet to retrieve all users in the forest that match the specified conditions.

Syntax

get-User [-Identity <UserIdParameter>] [-Credential <PSCredential>] [-DomainController <Fqdn>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]

get-User [-Credential <PSCredential>] [-DomainController <Fqdn>] [-Filter <String>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]

get-User [-Anr <String>] [-Credential <PSCredential>] [-DomainController <Fqdn>] [-OrganizationalUnit <OrganizationalUnitIdParameter>] [-ReadFromDomainController <SwitchParameter>] [-RecipientTypeDetails <RecipientTypeDetails[]>] [-ResultSize <Unlimited>] [-SortBy <String>]

Detailed Description

No parameters are required. However, no more than one of the following parameters may be used in a Get-User command: Identity, Filter, or Anr.

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

Parameters

Parameter Required Type Description

Anr

Optional

System.String

The Anr parameter indicates that the argument will be resolved using ambiguous name resolution (ANR).

Credential

Optional

System.Management.Automation.PSCredential

The Credential parameter specifies the account used to read the Active Directory directory service.

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 restricts 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.UserIdParameter

The Identity parameter takes one of the following values:

  • GUID

  • Distinguished name (DN)

  • Domain\Account

  • User principal name (UPN)

  • Legacy Exchange DN

  • Simple Mail Transfer Protocol (SMTP) address

  • Alias

OrganizationalUnit

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

The OrganizationalUnit parameter returns objects only from the specified organizational unit (OU).

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.

The available recipient type details for this parameter are:

  • ConferenceRoomMailbox

  • DisabledUser

  • EquipmentMailbox

  • LegacyMailbox

  • LinkedMailbox

  • UserMailbox

  • MailUser

  • User

ResultSize

Optional

Microsoft.Exchange.Data.Unlimited

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

Sortby

Optional

System.String

The SortBy parameter sorts by a single attribute in ascending order.

Input Types

Return Types

Errors

Error Description

 

 

Exceptions

Exceptions Description

 

 

Example

The first example retrieves information about your users in the Marketing OU.

The second example uses the Filter parameter to retrieve information about all users that have the word "Manager" at the end of their title.

Get-User -OrganizationalUnit "Marketing"
Get-User -Filter {Title -like '*Manager'}

You can use any Active Directory user attribute to construct a filter string for the Filter parameter in the Get-User cmdlet. To learn more about the comparison operators that you can use in the filter string, see Comparison Operators.