Commands › Exchange Online
Set-MailUser
Modify mail users. Mail users (also known as mail-enabled users) have email addresses and accounts in the Exchange organization, but they don't have Exchange mailboxes.
Quick start script
# Set-MailUser — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org
# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-MailUser
$before | Format-List
# 3. Make the change (dry run first)
Set-MailUser -Identity <MailUserIdParameter> -EnableLitigationHoldForMigration <SwitchParameter> -ExcludeFromAllHolds <SwitchParameter> -WhatIf
Set-MailUser -Identity <MailUserIdParameter> -EnableLitigationHoldForMigration <SwitchParameter> -ExcludeFromAllHolds <SwitchParameter>
# 4. Verify and diff
$after = Get-MailUser
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 13 parameter sets
Identity (Default)
Set-MailUser [-Identity] <MailUserIdParameter>
[-AcceptMessagesOnlyFrom <MultiValuedProperty>]
[-AcceptMessagesOnlyFromDLMembers <MultiValuedProperty>]
[-AcceptMessagesOnlyFromSendersOrMembers <MultiValuedProperty>]
[-Alias <String>]
[-ArbitrationMailbox <MailboxIdParameter>]
[-ArchiveGuid <Guid>]
[-ArchiveName <MultiValuedProperty>]
[-BypassModerationFromSendersOrMembers <MultiValuedProperty>]
[-Confirm]
[-CreateDTMFMap <Boolean>]
[-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>]
[-EmailAddressPolicyEnabled <Boolean>]
[-EmailAddresses <ProxyAddressCollection>]
[-ExchangeGuid <Guid>]
[-ExtensionCustomAttribute1 <MultiValuedProperty>]
[-ExtensionCustomAttribute2 <MultiValuedProperty>]
[-ExtensionCustomAttribute3 <MultiValuedProperty>]
[-ExtensionCustomAttribute4 <MultiValuedProperty>]
[-ExtensionCustomAttribute5 <MultiValuedProperty>]
[-ExternalEmailAddress <ProxyAddress>]
[-ForceUpgrade]
[-GrantSendOnBehalfTo <MultiValuedProperty>]
[-HiddenFromAddressListsEnabled <Boolean>]
[-IgnoreDefaultScope]
[-ImmutableId <String>]
[-MacAttachmentFormat <MacAttachmentFormat>]
[-MailTip <String>]
[-MailTipTranslations <MultiValuedProperty>]
[-MaxReceiveSize <MultiValuedProperty>]
[-MaxSendSize <MultiValuedProperty>]
[-MessageBodyFormat <MessageBodyFormat>]
[-MessageFormat <MessageFormat>]
[-ModeratedBy <MultiValuedProperty>]
[-ModerationEnabled <Boolean>]
[-Name <String>]
[-PrimarySmtpAddress <SmtpAddress>]
[-RecipientLimits <MultiValuedProperty>]
[-RecoverableItemsQuota <MultiValuedProperty>]
[-RecoverableItemsWarningQuota <MultiValuedProperty>]
[-RejectMessagesFrom <MultiValuedProperty>]
[-RejectMessagesFromDLMembers <MultiValuedProperty>]
[-RejectMessagesFromSendersOrMembers <MultiValuedProperty>]
[-RemovePicture]
[-RemoveSpokenName]
[-RequireSenderAuthenticationEnabled <Boolean>]
[-SamAccountName <String>]
[-SecondaryAddress <String>]
[-SecondaryDialPlan <UMDialPlanIdParameter>]
[-SendModerationNotifications <TransportModerationNotificationFlags>]
[-SimpleDisplayName <String>]
[-SkipDualWrite]
[-UMDtmfMap <MultiValuedProperty>]
[-UseMapiRichTextFormat <UseMapiRichTextFormat>]
[-UsePreferMessageFormat <Boolean>]
[-UserCertificate <MultiValuedProperty>]
[-UserPrincipalName <String>]
[-UserSMimeCertificate <MultiValuedProperty>]
[-WhatIf]
[-WindowsEmailAddress <SmtpAddress>]
[<CommonParameters>]
EnableLitigationHoldForMigration
Set-MailUser [-Identity] <MailUserIdParameter> [-EnableLitigationHoldForMigration]
[-AcceptMessagesOnlyFrom <MultiValuedProperty>]
[-AcceptMessagesOnlyFromDLMembers <MultiValuedProperty>]
[-AcceptMessagesOnlyFromSendersOrMembers <MultiValuedProperty>]
[-Alias <String>]
[-ArchiveGuid <Guid>]
[-BypassModerationFromSendersOrMembers <MultiValuedProperty>]
[-Confirm]
[-CreateDTMFMap <Boolean>]
[-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>]
[-DataEncryptionPolicy <DataEncryptionPolicyIdParameter>]
[-DisplayName <String>]
[-EmailAddresses <ProxyAddressCollection>]
[-ExchangeGuid <Guid>]
[-ExtensionCustomAttribute1 <MultiValuedProperty>]
[-ExtensionCustomAttribute2 <MultiValuedProperty>]
[-ExtensionCustomAttribute3 <MultiValuedProperty>]
[-ExtensionCustomAttribute4 <MultiValuedProperty>]
[-ExtensionCustomAttribute5 <MultiValuedProperty>]
[-ExternalEmailAddress <ProxyAddress>]
[-FederatedIdentity <String>]
[-ForceUpgrade]
[-GrantSendOnBehalfTo <MultiValuedProperty>]
[-HiddenFromAddressListsEnabled <Boolean>]
[-HVEAccount]
[-ImmutableId <String>]
[-JournalArchiveAddress <SmtpAddress>]
[-MacAttachmentFormat <MacAttachmentFormat>]
[-MailTip <String>]
[-MailTipTranslations <MultiValuedProperty>]
[-MailboxRegion <String>]
[-MaxReceiveSize <MultiValuedProperty>]
[-MaxSendSize <MultiValuedProperty>]
[-MessageBodyFormat <MessageBodyFormat>]
[-MessageFormat <MessageFormat>]
[-MicrosoftOnlineServicesID <SmtpAddress>]
[-ModeratedBy <MultiValuedProperty>]
[-ModerationEnabled <Boolean>]
[-Name <String>]
[-Password <SecureString>]
[-PrimarySmtpAddress <SmtpAddress>]
[-RecipientLimits <MultiValuedProperty>]
[-RejectMessagesFrom <MultiValuedProperty>]
[-RejectMessagesFromDLMembers <MultiValuedProperty>]
[-RejectMessagesFromSendersOrMembers <MultiValuedProperty>]
[-RemoveMailboxProvisioningConstraint]
[-RequireSenderAuthenticationEnabled <Boolean>]
[-ResetPasswordOnNextLogon <Boolean>]
[-SecondaryAddress <String>]
[-SecondaryDialPlan <UMDialPlanIdParameter>]
[-SendModerationNotifications <TransportModerationNotificationFlags>]
[-SimpleDisplayName <String>]
[-UMDtmfMap <MultiValuedProperty>]
[-UseMapiRichTextFormat <UseMapiRichTextFormat>]
[-UsePreferMessageFormat <Boolean>]
[-UserCertificate <MultiValuedProperty>]
[-UserSMimeCertificate <MultiValuedProperty>]
[-WhatIf]
[-WindowsEmailAddress <SmtpAddress>]
[<CommonParameters>]
ExcludeFromAllHolds
Set-MailUser [-Identity] <MailUserIdParameter> [-ExcludeFromAllHolds]
[-AcceptMessagesOnlyFrom <MultiValuedProperty>]
[-AcceptMessagesOnlyFromDLMembers <MultiValuedProperty>]
[-AcceptMessagesOnlyFromSendersOrMembers <MultiValuedProperty>]
[-Alias <String>]
[-ArchiveGuid <Guid>]
[-BypassModerationFromSendersOrMembers <MultiValuedProperty>]
[-Confirm]
[-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>]
[-DataEncryptionPolicy <DataEncryptionPolicyIdParameter>]
[-DisplayName <String>]
[-EmailAddresses <ProxyAddressCollection>]
[-ExchangeGuid <Guid>]
[-ExtensionCustomAttribute1 <MultiValuedProperty>]
[-ExtensionCustomAttribute2 <MultiValuedProperty>]
[-ExtensionCustomAttribute3 <MultiValuedProperty>]
[-ExtensionCustomAttribute4 <MultiValuedProperty>]
[-ExtensionCustomAttribute5 <MultiValuedProperty>]
[-ExternalEmailAddress <ProxyAddress>]
[-FederatedIdentity <String>]
[-ForceUpgrade]
[-GrantSendOnBehalfTo <MultiValuedProperty>]
[-HiddenFromAddressListsEnabled <Boolean>]
[-HVEAccount]
[-ImmutableId <String>]
[-JournalArchiveAddress <SmtpAddress>]
[-MacAttachmentFormat <MacAttachmentFormat>]
[-MailTip <String>]
[-MailTipTranslations <MultiValuedProperty>]
[-MailboxRegion <String>]
[-MaxReceiveSize <MultiValuedProperty>]
[-MaxSendSize <MultiValuedProperty>]
[-MessageBodyFormat <MessageBodyFormat>]
[-MessageFormat <MessageFormat>]
[-MicrosoftOnlineServicesID <SmtpAddress>]
[-ModeratedBy <MultiValuedProperty>]
[-ModerationEnabled <Boolean>]
[-Name <String>]
[-Password <SecureString>]
[-PrimarySmtpAddress <SmtpAddress>]
[-RecipientLimits <MultiValuedProperty>]
[-RejectMessagesFrom <MultiValuedProperty>]
[-RejectMessagesFromDLMembers <MultiValuedProperty>]
[-RejectMessagesFromSendersOrMembers <MultiValuedProperty>]
[-RemoveMailboxProvisioningConstraint]
[-RequireSenderAuthenticationEnabled <Boolean>]
[-ResetPasswordOnNextLogon <Boolean>]
[-SendModerationNotifications <TransportModerationNotificationFlags>]
[-SimpleDisplayName <String>]
[-UseMapiRichTextFormat <UseMapiRichTextFormat>]
[-UsePreferMessageFormat <Boolean>]
[-UserCertificate <MultiValuedProperty>]
[-UserSMimeCertificate <MultiValuedProperty>]
[-WhatIf]
[-WindowsEmailAddress <SmtpAddress>]
[<CommonParameters>]
ExcludeFromAllOrgHolds
Set-MailUser [-Identity] <MailUserIdParameter> [-ExcludeFromAllOrgHolds]
[-AcceptMessagesOnlyFrom <MultiValuedProperty>]
[-AcceptMessagesOnlyFromDLMembers <MultiValuedProperty>]
[-AcceptMessagesOnlyFromSendersOrMembers <MultiValuedProperty>]
[-Alias <String>]
[-ArchiveGuid <Guid>]
[-BypassModerationFromSendersOrMembers <MultiValuedProperty>]
[-Confirm]
[-CreateDTMFMap <Boolean>]
[-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>]
[-DataEncryptionPolicy <DataEncryptionPolicyIdParameter>]
[-DisplayName <String>]
[-EmailAddresses <ProxyAddressCollection>]
[-ExchangeGuid <Guid>]
[-ExtensionCustomAttribute1 <MultiValuedProperty>]
[-ExtensionCustomAttribute2 <MultiValuedProperty>]
[-ExtensionCustomAttribute3 <MultiValuedProperty>]
[-ExtensionCustomAttribute4 <MultiValuedProperty>]
[-ExtensionCustomAttribute5 <MultiValuedProperty>]
[-ExternalEmailAddress <ProxyAddress>]
[-FederatedIdentity <String>]
[-ForceUpgrade]
[-GrantSendOnBehalfTo <MultiValuedProperty>]
[-HiddenFromAddressListsEnabled <Boolean>]
[-HVEAccount]
[-ImmutableId <String>]
[-JournalArchiveAddress <SmtpAddress>]
[-MacAttachmentFormat <MacAttachmentFormat>]
[-MailTip <String>]
[-MailTipTranslations <MultiValuedProperty>]
[-MailboxRegion <String>]
[-MaxReceiveSize <MultiValuedProperty>]
[-MaxSendSize <MultiValuedProperty>]
[-MessageBodyFormat <MessageBodyFormat>]
[-MessageFormat <MessageFormat>]
[-MicrosoftOnlineServicesID <SmtpAddress>]
[-ModeratedBy <MultiValuedProperty>]
[-ModerationEnabled <Boolean>]
[-Name <String>]
[-Password <SecureString>]
[-PrimarySmtpAddress <SmtpAddress>]
[-RecipientLimits <MultiValuedProperty>]
[-RejectMessagesFrom <MultiValuedProperty>]
[-RejectMessagesFromDLMembers <MultiValuedProperty>]
[-RejectMessagesFromSendersOrMembers <MultiValuedProperty>]
[-RemoveMailboxProvisioningConstraint]
[-RequireSenderAuthenticationEnabled <Boolean>]
[-ResetPasswordOnNextLogon <Boolean>]
[-SecondaryAddress <String>]
[-SecondaryDialPlan <UMDialPlanIdParameter>]
[-SendModerationNotifications <TransportModerationNotificationFlags>]
[-SimpleDisplayName <String>]
[-UMDtmfMap <MultiValuedProperty>]
[-UseMapiRichTextFormat <UseMapiRichTextFormat>]
[-UsePreferMessageFormat <Boolean>]
[-UserCertificate <MultiValuedProperty>]
[-UserSMimeCertificate <MultiValuedProperty>]
[-WhatIf]
[-WindowsEmailAddress <SmtpAddress>]
[<CommonParameters>]
9 more parameter sets — see the parameter table below.
Parameters (97)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.