Script repository

Get mailbox move status in Exchange Online

Updated on: Jan 18, 2026, Views: 5025

Exchange

The script gets the move status of a user mailbox in Exchange Online. The status is added to the Execution log. To execute the script, create a business rule, custom command or scheduled task configured for the User object type.

try
{
    # Get the object ID in Microsoft 365.
    $objectId = [Guid]$Context.TargetObject.Get("adm-AzureId")
}
catch
{
    return
}

# Connect to Exchange Online.
$Context.CloudServices.ConnectExchangeOnline()

try
{
    $moveRequest = Get-MoveRequest -Identity $objectId.ToString() -ErrorAction Stop
}
catch
{
    return
}

# Output Move request status.
$Context.LogMessage("Move request status: " + $moveRequest.Status, "Information")

Comments 0

You must be signed in to comment.

    Got questions?

    Support Questions & Answers

    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.