We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script repository

Enable remote mailbox

August 15, 2024 Views: 10633

The scripts enable a remote mailbox for the target user. To execute either of the scripts, create a business rule, custom command or scheduled task configured for User object type.

In the scripts, the $remoteRoutingAddressTemplate variable specifies a template for the Remote Routing Address which will be applied to the remote mailbox. You can use value references in the template (e.g. %username%).

Regular remote mailbox

Edit Remove
PowerShell
$remoteRoutingAddressTemplate = "%username%@mycompany.mail.onmicrosoft.com" # TODO: modify me

$Context.TargetObject.EnableRemoteMailbox($remoteRoutingAddressTemplate)

Shared remote mailbox

Edit Remove
PowerShell
$remoteRoutingAddressTemplate = "%username%@mycompany.mail.onmicrosoft.com" # TODO: modify me

$Context.TargetObject.EnableRemoteMailboxEx2($remoteRoutingAddressTemplate, "%username%", $False, $False, $True, $False, $NULL, $NULL)

Room remote mailbox

Edit Remove
PowerShell
$remoteRoutingAddressTemplate = "%username%@mycompany.mail.onmicrosoft.com" # TODO: modify me

$Context.TargetObject.EnableRemoteMailboxEx($remoteRoutingAddressTemplate, "%username%", $False, $True, $False, $NULL, $NULL)
Comments 6
avatar
ComputerHabit Aug 18, 2020
Script 1 doesn't seem to work in a hybrid situation.
avatar
Support Aug 19, 2020

Hello,

What script are you using, For Adaxes 2015 and earlier or For Adaxes 2016 and later? How exactly do you execute the script? Do you face any error messages? If you do, please, provide us with screenshots. Screenshots of the workflow setup will be very helpful.

Also, it is not required to use scripts to enable remote mailboxes, it can be done automatically when a Microsoft 365 license is assigned to a user. For details, have a look at the following help article: https://www.adaxes.com/help/?HowDoI.PerformExchangeTasks.ConfigureEnablingDisablingOfRemoteMailboxes.html.

avatar
Markone89 Mar 03, 2021
Dears,

I've tried this script in a hybrid enviorment but unfortunately it not works.
I do the following things:
- i make a custom task for assign a o365 licence (with the built in solution) and run a custom powershell script which contains this
Powershell script contains the following (I have a custom task to handle the upn in a custom way and it is works also):

$upn=$Context.TargetObject.Get("userprincipalname")
$rraddress= $upn.Split("@")[0]

$rraddress+="@ourCompany.mail.onmicrosoft.com"

$Context.TargetObject.EnableRemoteMailbox("$rraddress")


The user creation is makes successfull I can assign licence but when I want to enable the remote mailbox, i will got 0x51 error says my DC in unreachable. I tried it but it avaiable.

Should I trace it through the following guide? http://www.adaxes.com/help/EnableExchangeRequestLogging/

Thank you in advance

Adaxes version 2020.01
avatar
Support Mar 03, 2021
Hello,

This script should only be used when automatic enabling remote mailboxes cannot be used (e.g. when group-based licensing is used). If you directly assign Microsoft 365 licenses via Adaxes, you just need to configure it to automatically enable remote mailboxes and specify the required remote routing address template. For details, have a look at the following help article: https://www.adaxes.com/help/EnablingDisablingRemoteMailboxes.
avatar
markone89 Mar 04, 2021
Dear Support,

Unfortunately we cannot use the automatic enablement, because not all of our users are belongs to have a remote mailbox, we have to use the infra in hybrid mode.
avatar
Support Mar 04, 2021
Hello,

Thank you for clarifying. First of all, the $rraddress variable in the last line of your script should be specified without quotes:

Edit Remove
PowerShell
$Context.TargetObject.EnableRemoteMailbox($rraddress)

For troubleshooting purposes, please, send us (support@adaxes.com) a screenshot of the error message you are facing. Also, please, enable tracing of requests sent to Exchange servers, reproduce the issue and send us the log file. For information on how to enable the tracing, have a look at the following help article: https://www.adaxes.com/help/EnableExchangeRequestLogging.
Leave a comment
Loading...

Got questions?

Support Questions & Answers