New-EOPMailUser

This cmdlet is available only in Exchange Online Protection.

Use the New-EOPMailUser cmdlet to create mail users, also known as mail-enabled users, in standalone Exchange Online Protection (EOP) organizations without Exchange Online mailboxes. This cmdlet isn't available in EOP that's included with Exchange Enterprise CAL with Services licenses in on-premises Exchange; use the New-MailUser cmdlet instead.

Typically, standalone EOP organizations that also have on-premises Active Directory use directory synchronization to create users and groups in EOP. However, if you can't use directory synchronization, then you can use cmdlets to create and manage users and groups in EOP.

This cmdlet uses a batch processing method that results in a propagation delay of a few minutes before the results of the cmdlet are visible.

For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.

Syntax

New-EOPMailUser
   -MicrosoftOnlineServicesID <WindowsLiveId>
   -Name <String>
   -Password <String>
   [-Alias <String>]
   [-DisplayName <String>]
   [-ExternalEmailAddress <ProxyAddress>]
   [-FirstName <String>]
   [-Initials <String>]
   [-LastName <String>]
   [<CommonParameters>]

Description

You need to be assigned permissions before you can run this cmdlet. Although this topic lists all parameters for the cmdlet, you may not have access to some parameters if they're not included in the permissions assigned to you. To find the permissions required to run any cmdlet or parameter in your organization, see Find the permissions required to run any Exchange cmdlet.

Examples

Example 1

New-EOPMailUser -Name EdMeadows -MicrosoftOnlineServicesID EdMeadows@Contoso.onmicrosoft.com -ExternalEmailAddress EdMeadows@tailspintoys.com -Password (Get-Credential).password -FirstName Ed -LastName Meadows -DisplayName "Ed Meadows" -Alias edm

This example creates a mail user object for Ed Meadows while specifying several additional optional parameters and prompting you to enter the password.

Parameters

-Alias

The Alias parameter specifies the alias of the mail user. The maximum length is 64 characters.

The Alias value can contain letters, numbers and the following characters:

  • !, #, %, *, +, -, /, =, ?, ^, _, and ~.
  • $, &, ', `, {, }, and | need to be escaped (for example -Alias what`'snew) or the entire value enclosed in single quotation marks (for example, -Alias 'what'snew'). The & character is not supported in the Alias value for Azure AD Connect synchronization.
  • Periods (.) must be surrounded by other valid characters (for example, help.desk).
  • Unicode characters U+00A1 to U+00FF.

If you don't use the Alias parameter when you create a mail user, the left side of the MicrosoftOnlineServicesID parameter value is used. For example, helpdesk@contoso.onmicrosoft.com results in the Alias value helpdesk.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection

-DisplayName

The DisplayName parameter specifies the name of the mail user in the Exchange admin center (EAC).

If you don't use this parameter, the value of the Name parameter is used for the display name.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection

-ExternalEmailAddress

The ExternalEmailAddress parameter specifies the user's email address that's outside of the Exchange Online Protection organization. Email messages sent to the mail user are relayed to this external address.

If you don't use this parameter, the value of the MicrosoftOnlineServicesID parameter is used for the external email address.

Type:ProxyAddress
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection

-FirstName

The FirstName parameter specifies the user's first name.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection

-Initials

The Initials parameter specifies the user's middle initials.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection

-LastName

The LastName parameter specifies the user's last name.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection

-MicrosoftOnlineServicesID

The MicrosoftOnlineServicesID parameter specifies the user ID for the object. This parameter only applies to objects in the cloud-based service. It isn't available for on-premises deployments.

Type:WindowsLiveId
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection

-Name

The Name parameter specifies the name of the mail user object. The value specified in the Name parameter is also used for the DisplayName parameter if the DisplayName parameter isn't specified.

The Name parameter value can't exceed 64 characters.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection

-Password

The Password parameter specifies the password for the user's account.

You can use the following methods as a value for this parameter:

  • (ConvertTo-SecureString -String '<password>' -AsPlainText -Force).
  • Before you run this command, store the password as a variable (for example, $password = Read-Host "Enter password" -AsSecureString), and then use the variable ($password) for the value.
  • (Get-Credential).password to be prompted to enter the password securely when you run this command.
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
Applies to:Exchange Online Protection