Sdílet prostřednictvím


Set-MailUser

 

Applies to: Exchange Server 2007 SP1, Exchange Server 2007 SP2, Exchange Server 2007 SP3

Use the Set-MailUser cmdlet to modify the mail-related attributes of an existing user in the Active Directory directory service.

Syntax

set-MailUser -Identity <MailUserIdParameter> [-AcceptMessagesOnlyFrom <RecipientIdParameter[]>] [-AcceptMessagesOnlyFromDLMembers <RecipientIdParameter[]>] [-Alias <String>] [-Confirm [<SwitchParameter>]] [-CreateDTMFMap <$true | $false>] [-CustomAttribute1 <String>] [-CustomAttribute10 <String>] [-CustomAttribute11 <String>] [-CustomAttribute12 <String>] [-CustomAttribute13 <String>] [-CustomAttribute14 <String>] [-CustomAttribute15 <String>] [-CustomAttribute2 <String>] [-CustomAttribute3 <String>] [-CustomAttribute4 <String>] [-CustomAttribute5 <String>] [-CustomAttribute6 <String>] [-CustomAttribute7 <String>] [-CustomAttribute8 <String>] [-CustomAttribute9 <String>] [-DisplayName <String>] [-DomainController <Fqdn>] [-EmailAddresses <ProxyAddressCollection>] [-EmailAddressPolicyEnabled <$true | $false>] [-Extensions <MultiValuedProperty>] [-ExternalEmailAddress <ProxyAddress>] [-GrantSendOnBehalfTo <MailboxOrMailUserIdParameter[]>] [-HiddenFromAddressListsEnabled <$true | $false>] [-IgnoreDefaultScope <SwitchParameter>] [-MacAttachmentFormat <BinHex | AppleSingle | AppleDouble>] [-MaxReceiveSize <Unlimited>] [-MaxSendSize <Unlimited>] [-MessageBodyFormat <Text | Html | TextAndHtml>] [-MessageFormat <Text | Mime>] [-Name <String>] [-PrimarySmtpAddress <SmtpAddress>] [-RecipientLimits <Unlimited>] [-RejectMessagesFrom <RecipientIdParameter[]>] [-RejectMessagesFromDLMembers <RecipientIdParameter[]>] [-RequireSenderAuthenticationEnabled <$true | $false>] [-SamAccountName <String>] [-SecondaryAddress <String>] [-SecondaryDialPlan <UMDialPlanIdParameter>] [-SimpleDisplayName <String>] [-UMDtmfMap <MultiValuedProperty>] [-UseMapiRichTextFormat <Never | Always | UseDefaultSettings>] [-UsePreferMessageFormat <$true | $false>] [-UserPrincipalName <String>] [-UseRusServer <String>] [-WhatIf [<SwitchParameter>]] [-WindowsEmailAddress <SmtpAddress>]

set-MailUser [-AcceptMessagesOnlyFrom <RecipientIdParameter[]>] [-AcceptMessagesOnlyFromDLMembers <RecipientIdParameter[]>] [-Alias <String>] [-Confirm [<SwitchParameter>]] [-CreateDTMFMap <$true | $false>] [-CustomAttribute1 <String>] [-CustomAttribute10 <String>] [-CustomAttribute11 <String>] [-CustomAttribute12 <String>] [-CustomAttribute13 <String>] [-CustomAttribute14 <String>] [-CustomAttribute15 <String>] [-CustomAttribute2 <String>] [-CustomAttribute3 <String>] [-CustomAttribute4 <String>] [-CustomAttribute5 <String>] [-CustomAttribute6 <String>] [-CustomAttribute7 <String>] [-CustomAttribute8 <String>] [-CustomAttribute9 <String>] [-DisplayName <String>] [-DomainController <Fqdn>] [-EmailAddresses <ProxyAddressCollection>] [-EmailAddressPolicyEnabled <$true | $false>] [-Extensions <MultiValuedProperty>] [-ExternalEmailAddress <ProxyAddress>] [-GrantSendOnBehalfTo <MailboxOrMailUserIdParameter[]>] [-HiddenFromAddressListsEnabled <$true | $false>] [-IgnoreDefaultScope <SwitchParameter>] [-Instance <MailUser>] [-MacAttachmentFormat <BinHex | AppleSingle | AppleDouble>] [-MaxReceiveSize <Unlimited>] [-MaxSendSize <Unlimited>] [-MessageBodyFormat <Text | Html | TextAndHtml>] [-MessageFormat <Text | Mime>] [-Name <String>] [-PrimarySmtpAddress <SmtpAddress>] [-RecipientLimits <Unlimited>] [-RejectMessagesFrom <RecipientIdParameter[]>] [-RejectMessagesFromDLMembers <RecipientIdParameter[]>] [-RequireSenderAuthenticationEnabled <$true | $false>] [-SamAccountName <String>] [-SecondaryAddress <String>] [-SecondaryDialPlan <UMDialPlanIdParameter>] [-SimpleDisplayName <String>] [-UMDtmfMap <MultiValuedProperty>] [-UseMapiRichTextFormat <Never | Always | UseDefaultSettings>] [-UsePreferMessageFormat <$true | $false>] [-UserPrincipalName <String>] [-UseRusServer <String>] [-WhatIf [<SwitchParameter>]] [-WindowsEmailAddress <SmtpAddress>]

Detailed Description

Use the Set-MailUser cmdlet to modify the mail-related attributes of a mail-enabled user in Active Directory.

To run the Set-MailUser cmdlet, the account you use must be delegated the following:

  • Exchange Recipient Administrator role

For more information about permissions, delegating roles, and the rights that are required to administer Microsoft Exchange Server 2007, see Permission Considerations.

Note

Not all user attributes can be modified with the Set-MailUser cmdlet. You can set additional user attributes that are not mail related with the Set-User cmdlet.

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Exchange.Configuration.Tasks.MailUserIdParameter

The Identity parameter takes one of the following values:

  • ADObjectID

  • GUID

  • Distinguished name (DN)

  • Domain\SamAccountName

  • User principal name (UPN)

  • Legacy DN

  • E-mail address

  • User alias

  • The Identity parameter cannot be used if the Instance parameter is specified.

AcceptMessagesOnlyFrom

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AcceptMessagesOnlyFrom parameter specifies the mailbox users, mail users, and mail contacts that can send e-mail messages to this mail user. You can also specify Microsoft Exchange as a valid recipient for this parameter. If you configure a mail user to accept messages only from the Microsoft Exchange recipient, it will only receive system-generated messages.

The AcceptMessagesOnlyFrom parameter can take any of the following values for the valid senders:

  • Distinguished name (DN)

  • Canonical name

  • GUID

  • Name

  • Display name

  • Alias

  • Exchange DN

  • Primary SMTP e-mail address

By default, this parameter is blank. This default value enables the mail user to accept messages from all senders.

AcceptMessagesOnlyFromDLMembers

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The AcceptMessagesOnlyFromDLMembers parameter specifies the distribution groups whose members are allowed to send e-mail messages to this mail user. You can use any of the following values for the allowed distribution groups:

  • Distinguished name (DN)

  • Canonical name

  • GUID

  • Name

  • Display name

  • Legacy Exchange DN

  • Primary SMTP e-mail address.

By default, this parameter is blank. This default value enables the mail user to accept messages from all senders.

Alias

Optional

System.String

The Alias parameter specifies the alias of the user. An alias can contain letters, numbers, and the following punctuation marks and symbols:

  • !

  • #

  • $

  • %

  • ^

  • &

  • *

  • +

  • -

  • .

  • /

  • =

  • ?

  • _

  • {

  • }

  • |

  • ~

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm parameter causes the command to pause processing and requires you to acknowledge what the command will do before processing continues. You don't have to specify a value with the Confirm parameter.

CreateDTMFMap

Optional

System.Boolean

This parameter specifies that a dual tone multi-frequency (DTMF) map be created for the user.

CustomAttribute1

Optional

System.String

The CustomAttribute1 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute10

Optional

System.String

The CustomAttribute10 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute11

Optional

System.String

The CustomAttribute11 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute12

Optional

System.String

The CustomAttribute12 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute13

Optional

System.String

The CustomAttribute13 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute14

Optional

System.String

The CustomAttribute14 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute15

Optional

System.String

The CustomAttribute15 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute2

Optional

System.String

The CustomAttribute2 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute3

Optional

System.String

The CustomAttribute3 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute4

Optional

System.String

The CustomAttribute4 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute5

Optional

System.String

The CustomAttribute5 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute6

Optional

System.String

The CustomAttribute6 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute7

Optional

System.String

The CustomAttribute7 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute8

Optional

System.String

The CustomAttribute8 parameter specifies custom attributes. You can use these attributes to store additional information.

CustomAttribute9

Optional

System.String

The CustomAttribute9 parameter specifies custom attributes. You can use these attributes to store additional information.

DisplayName

Optional

System.String

The DisplayName parameter specifies the display name of the user.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

To specify the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory, include the DomainController parameter in the command.

EmailAddresses

Optional

Microsoft.Exchange.Data.ProxyAddressCollection

The EmailAddresses parameter can be used to specify the e-mail alias of the mail user. All valid Microsoft Exchange 2007 e-mail address types may be used. You can specify multiple values for the EmailAddresses parameter as a comma-delimited list.

Important

Exchange 2007 does not validate custom addresses for correct formatting. You must make sure that the custom address that you specify complies with the format requirements for that address type. Because X.400 addresses are considered custom addresses in Exchange 2007, they are also not validated. Therefore, you must provide the correct syntax when you specify an X.400 address.

EmailAddressPolicyEnabled

Optional

System.Boolean

The EmailAddressPolicyEnabled parameter specifies whether the e-mail addresses for the mailbox will be automatically updated based on the e-mail address policies defined. When this parameter is set to $true, you cannot change the PrimarySmtpAddress or WindowsEmailAddress parameters.

Extensions

Optional

Microsoft.Exchange.Data.MultiValuedProperty

This parameter specifies one or more extension numbers for the user. When the parameter is set, all extension numbers within the dial plan must be unique.

ExternalEmailAddress

Optional

Microsoft.Exchange.Data.ProxyAddress

The ExternalEmailAddress parameter specifies an e-mail address outside of the organization. E-mail messages sent to the user are sent to this external address.

GrantSendOnBehalfTo

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter

The GrantSendOnBehalfTo parameter specifies the distinguished name (DN) of recipients that can send messages on behalf of this user.

HiddenFromAddressListsEnabled

Optional

System.Boolean

The HiddenFromAddressListsEnabled parameter specifies whether the user appears in the address list. The default value is $false.

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.

Instance

Optional

Microsoft.Exchange.Data.Directory.Management.MailUser

The Instance parameter enables you to pass an entire object to the command to be processed. It is mainly used in scripts where an entire object must be passed to the command.

MacAttachmentFormat

Optional

Microsoft.Exchange.Data.Directory.Recipient.MacAttachmentFormat

The MacAttachmentFormat parameter specifies the Apple Macintosh Operating System attachment format for messages that are sent to the mail user. The valid values for this parameter are:

  • BinHex

  • AppleSingle

  • AppleDouble

By default, this parameter is set to BinHex.

The acceptable values for the MacAttachmentFormat parameter are dependent on the MessageFormat parameter. If the MessageFormat parameter is set to Text, you can only use BinHex values for this parameter. If the MessageFormat parameter is set to Mime, you can only use BinHex, AppleSingle or AppleDouble values for this parameter.

MaxReceiveSize

Optional

Microsoft.Exchange.Data.Unlimited

The MaxReceiveSize parameter specifies the maximum size of e-mail messages that can be received by the mail user, from 1 kilobyte (KB) to 2,097,151 KB.

If not specified, there will be no size restrictions.

MaxSendSize

Optional

Microsoft.Exchange.Data.Unlimited

The MaxSendSize parameter specifies the maximum size of e-mail messages that can be sent by the mail user, from 1 KB to 2,097,151 KB.

If not specified, there will be no size restrictions.

MessageBodyFormat

Optional

Microsoft.Exchange.Data.Directory.Recipient.MessageBodyFormat

The MessageBodyFormat parameter specifies the message body format for messages that are sent to the mail user. The valid values for this parameter are:

  • Text

  • Html

  • TextAndHtml

By default, this parameter is set to TextAndHtml.

The MessageFormat and MessageBodyFormat parameters are interdependent. If the MessageFormat parameter is set to Mime, the MessageBodyFormat parameter can be set to any valid value. However, if the MessageFormat parameter is set to Text, the MessageBodyFormat parameter can only be set to Text. Therefore, if you want to set this parameter to Html or TextAndHtml, you must also set the MessageFormat parameter to Mime.

MessageFormat

Optional

Microsoft.Exchange.Data.Directory.Recipient.MessageFormat

The MessageFormat parameter specifies the message format for messages that are sent to the mail user.

The valid values for this parameter are:

  • Text

  • Mime

By default, this parameter is set to Mime.

The MessageFormat and MessageBodyFormat parameters are interdependent. If the MessageFormat parameter is set to Mime, the MessageBodyFormat parameter can be set to any valid value. However, if the MessageFormat parameter is set to Text, the MessageBodyFormat parameter can only be set to Text. Therefore, if you want to change the MessageFormat parameter from Mime to Text, you must also change the MessageBodyFormat parameter to Text.

Name

Optional

System.String

The Name parameter specifies the name of the user.

PrimarySmtpAddress

Optional

Microsoft.Exchange.Data.SmtpAddress

The PrimarySmtpAddress parameter specifies the primary SMTP address.

RecipientLimits

Optional

Microsoft.Exchange.Data.Unlimited

The RecipientLimits parameter specifies the maximum number of recipients for messages from this user.

RejectMessagesFrom

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The RejectMessagesFrom parameter specifies the recipients from which to reject messages.

RejectMessagesFromDLMembers

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The RejectMessagesFromDLMembers parameter specifies the distribution list members from which to reject messages.

RequireSenderAuthenticationEnabled

Optional

System.Boolean

The RequireSenderAuthenticationEnabled parameter specifies whether to accept messages only from authenticated recipients. The default value is $false.

SamAccountName

Optional

System.String

The SamAccountName parameter defines the logon name used to support clients and servers running older versions of the operating system, such as Microsoft Windows NT 4.0, Windows 98, Windows 95, and LAN Manager. This attribute must contain fewer than 20 characters. An account name can contain letters, numbers, and the following punctuation marks and symbols:

  • !

  • #

  • $

  • %

  • ^

  • &

  • -

  • .

  • _

  • {

  • }

  • |

  • ~

SecondaryAddress

Optional

System.String

This parameter specifies the secondary address that is used by the UM-enabled user.

SecondaryDialPlan

Optional

Microsoft.Exchange.Configuration.Tasks.UMDialPlanIdParameter

This parameter specifies a secondary UM dial plan to use. This parameter is provided to create a secondary proxy address.

SimpleDisplayName

Optional

System.String

The SimpleDisplayName parameter is used to display an alternative description of the object when only a limited set of characters is permitted. This limited set of characters consists of the following characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"()+,-./:?

UMDtmfMap

Optional

Microsoft.Exchange.Data.MultiValuedProperty

This parameter specifies if you want to create a user-defined DTMF map for the UM-enabled user. 

UseMapiRichTextFormat

Optional

Microsoft.Exchange.Data.Directory.Recipient.UseMapiRichTextFormat

The UseMapiRichTextFormat parameter specifies how messages in MAPI Rich Text Format (RTF) will be handled for this mail user. Set this parameter to Never to convert all messages sent to this user to plain text. Set this parameter to Always to always send messages to this user in MAPI RTF. Set this parameter to UseDefaultSettings to have the format decided based on the setting configured in the MAPI client that sent the message.

UsePreferMessageFormat

Optional

System.Boolean

The UsePreferMessageFormat parameter specifies whether the message format settings configured for the mail user will override the global settings configured for the remote domain. Set this parameter to $true to have the message format settings configured for the mail user to override any global settings.

UserPrincipalName

Optional

System.String

The UserPrincipalName parameter specifies a user principal name (UPN) for the user.

UseRusServer

Optional

System.String

noteNote:
This parameter is available only in Exchange 2007 SP2.

The UseRusServer parameter instructs the command to use the specified Mailbox server on which the Address List service is running to obtain and then set mailbox and Active Directory user attributes.

The Address List service is a component in the Exchange System Attendant service. The Address List service creates and maintains Exchange-specific attribute values in Active Directory. You can use the Address List service to update recipient objects in a domain by using specific information, such as address list membership and e-mail addresses.

WhatIf

Optional

System.Management.Automation.SwitchParameter

The WhatIf parameter instructs the command to simulate the actions that it would take on the object. By using the WhatIf parameter, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf parameter.

WindowsEmailAddress

Optional

Microsoft.Exchange.Data.SmtpAddress

The WindowsEmailAddress parameter specifies the Windows e-mail address for this mailbox. This address is not used by Exchange.

Input Types

Return Types

Errors

Error Description

 

Exceptions

Exceptions Description

 

Example

In this example, the Set-MailUser command is used to set the e-mail address outside of the organization to which mail-enabled user John Peoples' e-mail is sent.

Set-MailUser john -ExternalEmailAddress john@tailspintoys.com