Migrating active user that was disabled in the AD and there is a need to migrate this user as leaver can cause error “missing license” on Office 365 mailbox.
A couple of SQL cleaning and UI actions need to be done to bypass this issue and migrate former active user as a leaver.
1) Be sure Journal Commander leaver functionality is set 
Go to Configuration > Office 365 environment > Select JC link and check the setting. One example of settings on the picture below:

2) Delete user, make him real leaver in the database

--be sure you do select before deletion and verify samaccount name which needs to be deleted
select * from [ArchiveShuttleDirectory].[dbo].[User]
where PrimarySMTPAddress = ''
--delete user with all related data
declare @sid varchar(118)
select @sid = usersid FROM [ArchiveShuttleDirectory].[dbo].[User] where sAMAccountName in ('xxxxxx')
delete from [ArchiveShuttleDirectory].[dbo].[UserProxyAddress]
where UserSid in (@sid)
delete from [ArchiveShuttleDirectory].[dbo].[ContainerToUser]
where UserSid in (@sid)
delete from [ArchiveShuttleDirectory].[dbo].[ExchangeMailbox]
where OwnerUserSid in (@sid)
delete from [ArchiveShuttleDirectory].[dbo].[UserToUserGroup]
where UserSid in (@sid)
delete FROM [ArchiveShuttleDirectory].[dbo].[ContainerContentOperationsEnterpriseVault]
where containerid in (SELECT ContainerId  FROM [ArchiveShuttleDirectory].[dbo].[EVArchive]
where OwnerUserSid in (@sid))
delete FROM [ArchiveShuttleDirectory].[dbo].[EVArchive]
where OwnerUserSid in (@sid)
delete from [ArchiveShuttleDirectory].[dbo].[Office365Mailbox]
where UserSid in (@sid)
--only for JE mappings
delete FROM [ArchiveShuttleDirectory].[dbo].[JournalExplosionUserMapping]
where UserSid in (@sid)
delete from [ArchiveShuttleDirectory].[dbo].[User]
where usersid in (@sid)

3) Enable the same user in Journal Commander User Management screen
a) Click ADD, search for the user, save and close the popup window. The user will show up in the grid.
b) Select this user in the grid and click Enable for Import. If you want to assign some Folder Name policy you need to do so before the user is enabled for import.
4) Enable for import in both databases in SQL

update x set IsReadyForImport = 1
from [ArchiveShuttleDirectory].[dbo].[JournalExplosionUserMapping] x
where MappedSmtpAddress = ''
update x set isreadyforimport = 1
from [ArchiveShuttleItem_xxxx].[dbo].[SenderRecipientMapping] x
where PrimarySMTPAddress = ''

5) Clean Stage1 statistics

delete FROM [ArchiveShuttleDirectory].[dbo].[SenderRecipientMappingStatisticsConsolidated]

6) Run scheduled task for new statistics and retry hanging errors via UI

update x set runnow = 1
from [ArchiveShuttleDirectory].[dbo].[ScheduledTask] x
where ScheduledTaskId = 20

Now the user will be migrated as a leaver to newly created Office 365 mailbox with a temporary assigned license. Once all items are ingested license is removed.

Print Friendly, PDF & Email