Hi All,One of our customers recently had a user leave the company, but wanted to retain their mailbox data in the form of a Shared Mailbox (so that it did not consume an Office 365licence).The issue with Office 365 is that if you remove a licence from a user, it automatically deletes the associated mailbox!To work around this, the user’s mailbox data was exported to PST, a new Shared Mailbox created, and then the PST data was re-imported back into said Shared Mailbox.Once done, the user’s SMTP address was changed, and the Shared Mailbox SMTP address waschanged to that of the email address of the user, meaning all future new email would continue to flow into the Shared Mailbox.Theproblem with doing it this way is that although the Shared Mailbox works fine for external users, the old user object now can’t be deleted within the portal as the following error is receivedNot all selected users were deletedSome users can’t be deleted because they are managed with a service other than Office 365. You need to remove all licenses associated with the user and then delete the user. The SolutionUnfortunately the only way to delete the user is to connect to Office 365 via PowerShellby running the following commands in turn:-
- Set-ExecutionPolicy remotesigned
- $LiveCred = Get-Credential
- $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
- Connect-Msolservice
- Remove-MsolUser -UserPrincipalName <account id>
- Remove-MsolUser -UserPrincipalName <account id> -RemoveFromRecycleBin
Going forward, converting the mailbox from user to shared with the following commands is probably the best way to achieve the desired result (after you have taken a PST backup first of course):-
- Get-Mailbox -identity user@domain.com | set-mailbox -type “Shared”
- Set-Mailboxuser@domain.com -ProhibitSendReceiveQuota 10GB -ProhibitSendQuota 9.75GB -IssueWarningQuota 9.5GB
- Add-MailboxPermission user@domain.com-User “OtherUser” -AccessRights FullAccess
- Connect-MsolService
$VARIABLE = (Get-MSOLUser -UserPrincipalName user@domain.com).Licenses[0].AccountSkuId
Set-MsolUserLicense -UserPrincipalName user@domain.com -RemoveLicenses $VARIABLE
NB – Shared mailbox sizes increased from 5GB to 10GB last year.Hope this helps. Neil