Applies to: Exchange Server 2007
Topic Last Modified: 2007-06-05

Use the Get-Group cmdlet to query for existing groups.

Syntax

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

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 to use to read the Active Directory directory service. This is especially useful when specifying the global catalog. The password should be requested in a secure manner.

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 the filter to use to filter recipients.

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

Identity

Optional

Microsoft.Exchange.Configuration.Tasks.GroupIdParameter

The Identity parameter of the distribution group takes one of the following forms:

  • GUID

  • Distinguished name (DN)

  • User principal name (UPN)

  • LegacyExchangeDN

  • Domain\Account name

  • Alias

OrganizationalUnit

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

The OrganizationalUnit parameter limits results to a specific organizational unit (OU) container.

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:

  • MailEnabledContact

  • MailEnabledForestContact

  • NonUniversalGroup

  • UniversalDistributionGroup

  • UniversalSecurityGroup

ResultSize

Optional

Microsoft.Exchange.Data.Unlimited

The ResultSize parameter specifies the maximum number of members that will be returned.

SortBy

Optional

System.String

The SortBy attribute is used to sort the results.

Detailed Description

The Get-Group cmdlet returns all the existing groups in Microsoft Windows that match the specified filtering parameters.

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

Input Types

Return Types

Errors

Error Description

Exceptions

Exceptions Description

Example

The following code is an example of the Get-Group command. In this example, the Get-Group command is used without parameters to return all of the groups in Active Directory.

Copy Code
Get-Group