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

Move mailbox to/from Microsoft 365

March 09, 2023 Views: 2413

The scripts are used to move a mailbox to or from Microsoft 365. To execute either of scripts, use the Run a program or PowerShell script action in a Custom Command, Business Rule or Scheduled Task.

The scripts cannot be executed in Windows Powershell as they use the built-in Adaxes variable $Context.

Move mailbox from on-premises Exchange to Microsoft 365

Parameters:

  • $remoteServer - Specifies the complete domain name of an externally accessible on-premises Exchange server that facilitates remote move migrations between Microsoft 365 and local Exchange. The on-premises Exchange server should have the Client Access role configured and the Mailbox Replication Service Proxy (MRSProxy) service running.
  • $targetDeliveryDomain - Specifies the name of a Microsoft 365 domain used for mail routing. After a mailbox is moved, the user becomes mail-enabled in local Exchange, and their mail is routed to the specified Microsoft 365 domain.
  • $badItemLimit - Specifies the maximum number of bad items that are allowed before the request fails. A bad item is a corrupt item in the source mailbox that can’t be copied to the target mailbox. Use 0 to not skip bad items. The valid input range for this parameter is from 0 through 2147483647.
  • $largeItemLimit - Specifies the number of large items to skip if the request encounters such items in the mailbox. A large item is a message in the source mailbox that exceeds the maximum message size that’s allowed in the target mailbox. Use 0 to not skip large items.
Edit Remove
PowerShell
$remoteServer="mail.mycompany.com" # TODO: modify me
$targetDeliveryDomain="mycompany.mail.onmicrosoft.com" # TODO: modify me
$badItemLimit="0" # TODO: modify me
$largeItemLimit="0" # TODO: modify me

# Move mailbox
$Context.TargetObject.CreateMoveMailboxToM365Request($remoteServer, $targetDeliveryDomain, $badItemLimit, $largeItemLimit)

Move mailbox from Microsoft 365 to on-premises Exchange

Parameters:

  • $targetDatabaseName - Specifies the name of the database in the on-premises Exchange server to move the mailbox to.
  • $remoteServer - Specifies the complete domain name of an externally accessible on-premises Exchange server that facilitates remote move migrations between Microsoft 365 and local Exchange. The on-premises Exchange server should have the Client Access role configured and the Mailbox Replication Service Proxy (MRSProxy) service running.
  • $targetDeliveryDomain - Specifies
  • $badItemLimit - Specifies the maximum number of bad items that are allowed before the request fails. A bad item is a corrupt item in the source mailbox that can’t be copied to the target mailbox. Use 0 to not skip bad items. The valid input range for this parameter is from 0 through 2147483647.
  • $largeItemLimit - Specifies the number of large items to skip if the request encounters such items in the mailbox. A large item is a message in the source mailbox that exceeds the maximum message size that’s allowed in the target mailbox. Use 0 to not skip large items.
Edit Remove
PowerShell
$targetDatabaseName="Mailbox Database 1" # TODO: modify me
$remoteServer="mail.mycompany.com" # TODO: modify me
$targetDeliveryDomain="mycompany.com" # TODO: modify me
$badItemLimit="0" # TODO: modify me
$largeItemLimit="0" # TODO: modify me

# Move mailbox
$Context.TargetObject.CreateMoveMailboxFromM365Request($targetDatabaseName, $remoteServer, $targetDeliveryDomain, $badItemLimit, $largeItemLimit)
Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers