Export (0) Print
Expand All
Expand Minimize

Recipient Management Using One-line Commands in Exchange Management Shell (PART 2)

 

Topic Last Modified: 2010-02-24

Recipient management in Microsoft Exchange Server 2007 can be completed by using either the graphical user interface (GUI) in Exchange Management Console or by using command lines in the Exchange Management Shell.

The actions that you take in the Exchange Management Console can also be completed by typing a one-line command in the Exchange Management Shell. This topic describes some common recipient management scenarios that are completed by using Exchange Management Console. This topic also describes how the same actions can be completed by using a one-line command in Exchange Management Shell.

The scenarios that are described here address the actions that are performed in the following nodes:

  • Distribution Group

  • Mail Contact

  • Disconnected Mailbox.

This topic continues the discussion that starts in Recipient Management Using One-line Commands in Exchange Management Shell (PART 1).

Distribution groups are mail-enabled Active Directory directory service group objects. These groups expedite the mass sending of e-mail messages and other information within an Exchange organization.

Microsoft Exchange supports the following types of distribution groups:

  • Mail-enabled universal distribution groups: These are Active Directory distribution group objects that are mail-enabled. They can be used only to distribute messages to a group of recipients.

  • Mail-enabled universal security groups: These are Active Directory security group objects that are mail-enabled. They can be used to grant access permissions to resources in Active Directory, and can also be used to distribute messages.

  • Mail-enabled non-universal groups: These are Active Directory global or local group objects that are mail-enabled. In Microsoft Exchange, you can create or mail-enable only universal distribution groups. You may have mail-enabled groups that are migrated from previous versions of Exchange that are not universal groups. These groups can still be managed by using the Exchange Management Console or the Exchange Management Shell. We recommend that you convert any groups of this type to Universal groups to prevent member expansion problems in multi-domain environments.

  • Dynamic distribution groups: These are distribution groups for which membership is based on specific recipient filters instead of a defined set of recipients. Dynamic distribution groups were called query-based distribution groups in Exchange 2003.

This section discusses how to use the Exchange Management Console or the Exchange Management Shell to complete common tasks for common distribution group management scenarios.

noteNote:
These procedures require that you have Administrator permissions.

The steps to create a new distribution group by using the "New Distribution Group" wizard are similar to the steps to create a new mailbox by using the "New Mailbox" wizard.

To create a new distribution group, create a new group, and then mail-enable it. Or, mail-enable an existing group.

To start the "New Distribution Group" wizard, right-click Distribution Group, and then click New Distribution Group, or click New Distribution Group in the action pane. The New Distribution Group wizard starts. You can select to create a new distribution group and mailbox-enable it in one step, or to mailbox-enable an existing distribution group. During the process, you can specify any necessary mailbox information, such as mailbox type.

The same process can be completed by entering one line commands in the Exchange Management Shell. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Create a new distribution group, and mail-enable it

new-DistributionGroup -alias <New_ Distribution_Group_Alias> -name "<New_ Distribution_Group_Name>" -type <distribution | security> -org Users -SamAccountName Testers

Mail-enable an existing universal group

enable-DistributionGroup <Universal_Group_Name> -alias <Universal_Group_Alias>

Creating a new dynamic distribution group by using the Exchange Management Console is similar to creating new distribution group. Use the "New Dynamic Distribution Group" wizard, and follows the steps to create a new dynamic distribution group.

The same process can be completed by entering one line commands in the Exchange Management Shell. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Create a new dynamic distribution group using the “custom” RecipientFilter parameter (instead of the precanned filter syntax)

new-DynamicDistributionGroup -alias <New_ Dynamic_Distribution_Group_Alias> -name <New_ Dynamic_Distribution_Group_Alias> -recipientfilter {Company -eq "example"} -org Users

To add a member to a distribution group by using the Exchange Management Console, use Add on the Members tab in the distribution group's Properties.

The same process can be completed by entering one line commands in the Exchange Management Shell. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Add a member to a distribution group

add-DistributionGroupMember <Distribution_Group_Name> -Member <New_Member_Alias>

To set the Out of Office (OOF) message and the delivery report option for a distribution group, use the Exchange Management Console.

To do this, click the Advance tab in the distribution group Properties, and then click to select the Send out-of-office message to originator check box to set the OOF. Select the Send delivery reports to message originator to set the delivery report option.

The same process can be completed by entering one-line commands in the Exchange Management Shell. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Set OOF message and delivery report option for a distribution group

set-DistributionGroup <Distribution_Group_Name> -ReportToOriginatorEnabled:$True -SendOofMessageToOriginatorEnabled:$True

When many mailboxes must be added to a distribution group, the process can be simplified by using a CSV file together with a one-line command in Exchange Management Shell. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Create a distribution group for all team members based on the Avalanche.csv file that contains NHL Avalanche team roster information, including the following columns:
Pos,No,Player,Age,Ht,Wt,Born,Exp,Birth City

new-distributiongroup -alias avalanche -name "Avalanche Team" -type distribution -org users -SamAccountName AvalancheTeam
import-csv Avalanche.csv | foreach {add-distributiongroupmember avalanche -member "avalanche$($_.No)"}

Create a dynamic distribution group for players in the "center" position based on a CSV file named Avalanche.csv that includes the following columns:
Pos,No,Player,Age,Ht,Wt,Born,Exp,Birth City

import-csv Avalanche.csv | foreach {set-user "avalanche$($_.No)" -Department $_.Pos}
new-DynamicDistributionGroup -alias avalanche_centers -name avalanche_centers -recipientfilter {Company -eq "avalanche" -and Department -eq "centers"} -org Users

A one-line command can be used in the Exchange Management Shell to set the storage quotas for all the members of a distribution group. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Set storage quotas for all members in a distribution group

Get-DistributionGroup testdg | Get-DistributionGroupMember | Set-Mailbox -UseDatabaseQuotaDefaults:$False -IssueWarningQuota 90MB -ProhibitSendQuota 95MB -ProhibitSendReceiveQuota 100MB

Mail contacts are mail-enabled Active Directory objects that contain information about people or organizations that exist outside your Exchange organization. Each mail contact has an external e-mail address. There are several mail contact types, including MailEnabledContact and MailEnabledUser. Both of these types can be managed by using the Exchange Management Console or the Exchange Management Shell.

This section discusses common scenarios for mail-enabled contact management. However, this topic does not repeat scenarios that are similar to the Mailbox management scenarios and that are discussed in the topic Recipient Management Using One-line Commands in Exchange Management Shell (PART 1).

noteNote:
These procedures require that you have Administrator permissions.

You can create a new mail contact by creating a new contact and then mail-enabling it, or by mail-enabling an existing contact. The steps for creating a new mail contact by using the "New Mail Contact" wizard are similar to the steps to create a new mailbox by using the "New Mailbox" wizard.

To start the "New Mail Contact" wizard, right-click Mail Contact, and then click New Mail Contact, or click New Mail Contact in the action pane. The New Mail Contact wizard starts. and you can select to create a new distribution group and mailbox-enable it in one step, or mailbox-enable an existing mail contact. During the process, you can specify any necessary mailbox information, including mailbox type.

The same process can be completed by entering one line commands in the Exchange Management Shell. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Create a new mail contact

new-MailContact -alias <Mail_Contact_Alias> -name <Mail_Contact_Name> -org Users -ExternalEmailAddress <Alias@example.com>

Mail-enable an existing contact

enable-Mailcontact <Mail_Contact_Name> -alias <Mail_Contact_Alias> -ExternalEmailAddress <Alias@example.com>

Create a new mail user

new-MailUser -alias <Mail_Contact_Alias> -name <Mail_Contact_Name> -org Users -ExternalEmailAddress <Alias@example.com>

Mail-enable an existing user

enable-MailUser <Mail_Contact_Name> -alias <Mail_Contact_Alias> -ExternalEmailAddress <Alias@example.com>

When you must create many mail contacts, use a CSV file together with a one-line command in the Exchange Management Console. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Bulk create mail contacts based on a CSV file that is named "contacts.csv"; the CSV file contains the following columns:
name, company, department, displayName, targetAddress, mailNickname

import-csv contacts.csv | foreach { new-mailcontact -alias $_.mailnickname -name $_.displayName -ExternalEmailAddress $_.targetaddress -org Users }

A disconnected mailbox is a mailbox that is not associated with an Active Directory directory service user account. This section discusses how to use the Exchange Management Console or the Exchange Management Shell to complete common tasks for common disconnected mailbox management scenarios.

Disconnected mailboxes are displayed under the Disconnected Mailbox node in the Exchange Management Console. You can also view disconnected mailboxes by using the Exchange Management Shell.

The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Find disconnected mailboxes on a mailbox database

Get-MailboxStatistics -Database "Mailbox Database" | where { $_.DisconnectDate -ne $null }

To connect disconnected mailboxes by using the Exchange Management Console, right-click the mailbox name in the Disconnected Mailbox node, and then click Connect. The Connect Mailbox wizard starts and directs you to connect a mailbox. The same process can be completed by entering one-line commands in the Exchange Management Shell. The following table describes the action and the one-line command to use to complete the action.

 

Action One-line command

Connect all disconnected mailboxes that are stored in the specified mailbox database

Get-MailboxStatistics | where {$_.DisconnectDate -ne $null} | Connect-Mailbox -Database "Mailbox Database"

For more information about recipient management by using one-line commands in Exchange Server Shell, view the topic Recipient Management Using One-line Commands in Exchange Management Shell (PART 1).

For more information about how to complete recipient management by using the Exchange Management Console, view the topic Recipient Management Using the Exchange Management Console.

For more information about Distribution Groups, view the topic Create a Distribution Group.

For more information about Mail Contacts, view the topic Recipient Configuration > Mail Contact.

For more information about Disconnected Mailboxes, view the topic Recipient Configuration > Disconnected Mailbox.

 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft