Script repository
The scripts enables a remote mailbox for the target user. To execute either of the scripts, create a business rule, custom command or scheduled task configured for the 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%).
Script 1: Regular remote mailbox
$remoteRoutingAddressTemplate = "%username%@mycompany.mail.onmicrosoft.com" # TODO: modify me
$Context.TargetObject.EnableRemoteMailbox($remoteRoutingAddressTemplate)Script 2: Shared remote mailbox
The remote mailbox will have no archive and the primary SMTP address will be automatically generated by Exchange.
$remoteRoutingAddressTemplate = "%username%@mycompany.mail.onmicrosoft.com" # TODO: modify me
$Context.TargetObject.EnableRemoteMailboxEx2($remoteRoutingAddressTemplate, "%username%", $False, $False, $True, $False, $NULL, $NULL)Script 3: Room remote mailbox
The remote mailbox will have no archive and the primary SMTP address will be automatically generated by Exchange.
$remoteRoutingAddressTemplate = "%username%@mycompany.mail.onmicrosoft.com" # TODO: modify me
$Context.TargetObject.EnableRemoteMailboxEx($remoteRoutingAddressTemplate, "%username%", $False, $True, $False, $NULL, $NULL)
Comments 8
You must be signed in to comment.
ComputerHabit
Script 1 doesn't seem to work in a hybrid situation.
Support
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.
markone89
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):
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
Support
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.
markone89
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.
Support
Hello,
Thank you for clarifying. First of all, the $rraddress variable in the last line of your script should be specified without quotes:
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.
Grant
Is there a similar command to enable the remote archive mailbox? The equilivent command in Powershell to Enable-RemoteMailbox -Archive
Support
Hello Grant,
You can use method EnableRemoteMailboxEx as in the above scripts. To achieve the desired, set the fifth parameter to $true. The following article should be helpful: https://adaxes.com/sdk/IAdmExchangeRemoteMailboxOps/#EnableRemoteMailboxEx_details.