Commands › Exchange Online
New-MailUser
Create 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. Email messages sent to mail users are delivered to the specified external email address.
Quick start script
# New-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)
New-MailUser -Name <String> -ExternalEmailAddress <ProxyAddress> -FederatedIdentity <String> -WhatIf
New-MailUser -Name <String> -ExternalEmailAddress <ProxyAddress> -FederatedIdentity <String>
# 4. Verify and diff
$after = Get-MailUser
Compare-Object ($before | Out-String) ($after | Out-String)
Syntax — 7 parameter sets
DisabledUser
New-MailUser [-Name] <String> -ExternalEmailAddress <ProxyAddress>
[-Alias <String>]
[-ArbitrationMailbox <MailboxIdParameter>]
[-Confirm]
[-DisplayName <String>]
[-DomainController <Fqdn>]
[-FirstName <String>]
[-ImmutableId <String>]
[-Initials <String>]
[-LastName <String>]
[-MacAttachmentFormat <MacAttachmentFormat>]
[-MailboxRegion <String>]
[-MessageBodyFormat <MessageBodyFormat>]
[-MessageFormat <MessageFormat>]
[-ModeratedBy <MultiValuedProperty>]
[-ModerationEnabled <Boolean>]
[-OrganizationalUnit <OrganizationalUnitIdParameter>]
[-PrimarySmtpAddress <SmtpAddress>]
[-RemotePowerShellEnabled <Boolean>]
[-ResetPasswordOnNextLogon <Boolean>]
[-SamAccountName <String>]
[-SendModerationNotifications <TransportModerationNotificationFlags>]
[-UsePreferMessageFormat <Boolean>]
[-WhatIf]
[<CommonParameters>]
EnabledUser
New-MailUser [-Name] <String> -ExternalEmailAddress <ProxyAddress> -Password <SecureString> -UserPrincipalName <String>
[-Alias <String>]
[-ArbitrationMailbox <MailboxIdParameter>]
[-Confirm]
[-DisplayName <String>]
[-DomainController <Fqdn>]
[-FirstName <String>]
[-ImmutableId <String>]
[-Initials <String>]
[-LastName <String>]
[-MacAttachmentFormat <MacAttachmentFormat>]
[-MailboxRegion <String>]
[-MessageBodyFormat <MessageBodyFormat>]
[-MessageFormat <MessageFormat>]
[-ModeratedBy <MultiValuedProperty>]
[-ModerationEnabled <Boolean>]
[-OrganizationalUnit <OrganizationalUnitIdParameter>]
[-PrimarySmtpAddress <SmtpAddress>]
[-RemotePowerShellEnabled <Boolean>]
[-ResetPasswordOnNextLogon <Boolean>]
[-SamAccountName <String>]
[-SendModerationNotifications <TransportModerationNotificationFlags>]
[-UsePreferMessageFormat <Boolean>]
[-WhatIf]
[<CommonParameters>]
EnableRoomMailboxAccount
New-MailUser [-Name] <String> [-MicrosoftOnlineServicesID <WindowsLiveId>]
[-Alias <String>]
[-Confirm]
[-DisplayName <String>]
[-FirstName <String>]
[-ImmutableId <String>]
[-Initials <String>]
[-LastName <String>]
[-MailboxRegion <String>]
[-ModeratedBy <MultiValuedProperty>]
[-ModerationEnabled <Boolean>]
[-OrganizationalUnit <OrganizationalUnitIdParameter>]
[-PrimarySmtpAddress <SmtpAddress>]
[-RemotePowerShellEnabled <Boolean>]
[-SendModerationNotifications <TransportModerationNotificationFlags>]
[-WhatIf]
[<CommonParameters>]
FederatedUser
New-MailUser [-Name] <String> -FederatedIdentity <String>
[-ExternalEmailAddress <ProxyAddress>]
[-Alias <String>]
[-ArbitrationMailbox <MailboxIdParameter>]
[-Confirm]
[-DisplayName <String>]
[-DomainController <Fqdn>]
[-FirstName <String>]
[-ImmutableId <String>]
[-Initials <String>]
[-LastName <String>]
[-MailboxRegion <String>]
[-ModeratedBy <MultiValuedProperty>]
[-ModerationEnabled <Boolean>]
[-OrganizationalUnit <OrganizationalUnitIdParameter>]
[-PrimarySmtpAddress <SmtpAddress>]
[-RemotePowerShellEnabled <Boolean>]
[-ResetPasswordOnNextLogon <Boolean>]
[-SamAccountName <String>]
[-SendModerationNotifications <TransportModerationNotificationFlags>]
[-WhatIf]
[<CommonParameters>]
3 more parameter sets — see the parameter table below.
Parameters (30)
Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.