Script repository
The script updates ExchangeGuid of a user remote mailbox with the GUID of the mailbox in Exchange Online. 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()
# Get mailbox
$mailbox = Get-Mailbox $objectId.ToString()
# Update ExchangeGuid.
$Context.TargetObject.Put("msExchMailboxGuid", $mailbox.ExchangeGuid.ToByteArray())
$Context.TargetObject.SetInfo()
Comments 0
You must be signed in to comment.