Office 365 – Mailbox Deleted and converted to Mail enabled object but Contact Not visible in Gal


I recently got a request to remove a mailbox and convert the account into a mail enabled Object, as we have Hybrid environment what I did is removed mailbox license to remove the mailbox from cloud, and replace target address in our on premise Active Directory with the required smtp and waited for Dirsync to run for object update, but post several Dirsync ran successfully object was still not updated in the GAL as a contact, and simply disappeared from the GAL.


This issue is caused by the cloud side user account, to fix the issue I had to delete the current user account at the cloud side which was associated with the mailbox and with next Dirsync contact appear in GAL successfully.

Note: Take PST backup of the mailbox as there may be issues if trying to restore mailbox from retention with 30 days of mailbox deletion.

Connect to "Windows Azure Active Directory for Windows PowerShell"

You can download it from the below link if not already installed

Download the 32-bit module

Download the 64-bit module

Once you are connected to MSOL Run below Command to remove currently associated account from the cloud.

Get-MsolUser -UserPrincipalName| Remove-MsolUser –force

Confirm if the object has been removed by running the command

Get-MsolUser -ReturnDeletedUsers -UserPrincipalName | remove-MsolUser –RemoveFromRecycleBin -force

Wait for couple of Dirsync to run to check if the object has been recreated by the Dirsync process by running the below command.

Get-MsolUser -ReturnDeletedUsers -UserPrincipalName

If the object appears to be recreated check in the GAL now the correct contact should be appearing.



Removing multiple users permanently from MSOL

Save all the users alias in a File, and then run the below command to collect all the users in an array $users

1)      - $Users = get-content "File.txt"


Check if the users available in msol


2)      - foreach ($u in $users) {

$upn = $u +""

Get-MsolUser -UserPrincipalName $upn }

Soft Delete user from msol


3)      - foreach ($u in $users) {

$upn = $u +""

                Get-MsolUser -UserPrincipalName $upn | Remove-MsolUser –force }

Permanently Deleting user from msol


4)      - foreach ($u in $users) {

$upn = $u +""

Get-MsolUser -ReturnDeletedUsers -UserPrincipalName $upn | `

Remove-MsolUser –RemoveFromRecycleBin –force }