Adaxes Web Interface HelpShow AllHide All

Configure Enabling and Disabling of Remote Mailboxes

By default, if an Exchange organization operates in hybrid mode, Adaxes enables and disables remote mailboxes when assigning and revoking Office 365 licenses with access to Exchange Online. You can configure how Adaxes enables or disables remote mailboxes. Alternatively, you can completely turn off the feature.

Settings related to remote mailboxes are specific for each Office 365 Tenant. To change them, you need to modify the Tenants with the help of PowerShell.

Below, you can find script samples that demonstrate how to change each setting. To run a script:

  1. On the computer where your Adaxes service is installed, launch Windows PowerShell.

    How
    • Press Win+R.

    • Type PowerShell.exe and press Enter.

  2. Copy the necessary script and paste it to the PowerShell console.

  3. When the script runs, enter credentials of an Adaxes service administrator.

Enabling Remote Mailboxes

The following script allows you to configure how Adaxes enables remote mailboxes.

In the script, $tenantName specifies the name of the Office 365 Tenant that you want to change settings for, and $enableRemoteMailboxSetting specifies the desired behavior. Possible values:

  • $NULL (default behavior) - remote mailboxes will be enabled if the Exchange Organization operates in hybrid mode;
  • $False - remote mailboxes will never be enabled;
  • $True - remote mailboxes will be enabled even if the Exchange Organization is not a part of a hybrid deployment.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$tenantName = "Company" # TODO: Modify me
$enableRemoteMailboxSetting = $True # TODO: Modify me

# Bind to Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Prompt for credentials of a service administrator
$credential = Get-Credential

# Bind to the configuration container
$configurationContainerPath = $admService.Backend.GetConfigurationContainerPath("CloudServicesO365")
$configurationContainer = $admService.OpenObject($configurationContainerPath, $credential.UserName,`
    $credential.GetNetworkCredential().Password, 0)

# Get tenant
$tenant = $configurationContainer.GetObject("adm-O365Tenant", "CN=$tenantName")

# Update parameter
$tenant.EnableRemoteMailboxes = $enableRemoteMailboxSetting

# Save changes
$tenant.SetInfo()

Disabling Remote Mailboxes

The following script allows you to configure how Adaxes disables remote mailboxes.

In the script, $tenantName specifies the name of the Office 365 Tenant that you want to change settings for, and $disableRemoteMailboxSetting specifies the desired behavior. Possible values:

  • $NULL (default behavior) - remote mailboxes will be disabled if the Exchange Organization operates in hybrid mode;
  • $False - remote mailboxes will never be disabled;
  • $True - remote mailboxes will be disabled even if the Exchange Organization is not a part of a hybrid deployment.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$tenantName = "Company" # TODO: Modify me
$disableRemoteMailboxSetting = $True # TODO: Modify me

# Bind to Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Prompt for credentials of a service administrator
$credential = Get-Credential

# Bind to the configuration container
$configurationContainerPath = $admService.Backend.GetConfigurationContainerPath("CloudServicesO365")
$configurationContainer = $admService.OpenObject($configurationContainerPath, $credential.UserName,`
    $credential.GetNetworkCredential().Password, 0)

# Get tenant
$tenant = $configurationContainer.GetObject("adm-O365Tenant", "CN=$tenantName")

# Update parameter
$tenant.DisableRemoteMailboxes = $disableRemoteMailboxSetting

# Save changes
$tenant.SetInfo()

Changing Remote Routing Address Template

By default, when a remote mailbox is enabled, the remote routing address is generated by Exchange based on the default email address policy. To override the policy and generate the routing address based on your own template, use the below script.

In the script, $tenantName specifies the name of the Office 365 Tenant that you want to change settings for, and $remoteRoutingAddressTemplate specifies the template.

To reset the setting to default and use addresses generated by Exchange automatically, specify $NULL for $remoteRoutingAddressTemplate.

In order to generate a unique address for each user, you need to use value references. When a remote mailbox is created, value references are replaced with the corresponding property values of the user account. For example, if you specify %firstname%.%lastname%@example.mail.onmicrosoft.com, and create a user whose first name is John and last name is Smith, the remote routing address will be John.Smith@example.mail.onmicrosoft.com.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$tenantName = "Company" # TODO: Modify me
$remoteRoutingAddressTemplate = "%firstname%.%lastname%@example.mail.onmicrosoft.com" # TODO: Modify me

# Bind to Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Prompt for credentials of a service administrator
$credential = Get-Credential

# Bind to the configuration container
$configurationContainerPath = $admService.Backend.GetConfigurationContainerPath("CloudServicesO365")
$configurationContainer = $admService.OpenObject($configurationContainerPath, $credential.UserName,`
    $credential.GetNetworkCredential().Password, 0)

# Get tenant
$tenant = $configurationContainer.GetObject("adm-O365Tenant", "CN=$tenantName")

# Update parameter
$tenant.RemoteMailboxesRemoteRoutingAddress = $remoteRoutingAddressTemplate

# Save changes
$tenant.SetInfo()

Viewing Current Settings

To view current settings for remote mailboxes, use the following PowerShell code. Specify the name of the Office 365 Tenant you want to view settings for in $tenantName, and then run the script.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$tenantName = "Company" # TODO: modify me

# Connect to Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Prompt for credentials of a service administrator
$credential = Get-Credential

# Bind to the configuration container
$configurationContainerPath = $admService.Backend.GetConfigurationContainerPath("CloudServicesO365")
$configurationContainer = $admService.OpenObject($configurationContainerPath, $credential.UserName,`
    $credential.GetNetworkCredential().Password, 0)

# Get tenant
$tenant = $configurationContainer.GetObject("adm-O365Tenant", "CN=$tenantName")

# Settings for enabling remote mailboxes
$result = "Enable remote mailboxes: "
switch ($tenant.EnableRemoteMailboxes)
{
    $True
    {
      $result += "Always"
    }
    $False
    {
      $result += "Never"
    }
    default
    {
      $result += "Only if the Exchange organization of the user is in the hybrid mode"
    }
}

# Settings for disabling remote mailboxes
$result += "`r`nDisable remote mailboxes: "
switch ($tenant.DisableRemoteMailboxes)
{
    $True
    {
      $result += "Always"
    }
    $False
    {
      $result += "Never"
    }
    default
    {
      $result += "Only if the Exchange organization of the user is in the hybrid mode"
    }
}

# Settings for remote routing addresses
$result += "`r`nRemote routing address template: "
if ($tenant.RemoteMailboxesRemoteRoutingAddress -eq $NULL)
{
    $result += "<Let Exchange generate routing addresses>"
}
else
{
    $result += $tenant.RemoteMailboxesRemoteRoutingAddress
}

Write-Host $result