Can't remove office 365 licenses

Copper Contributor

Hi folks!

I'm trying to remove mailboxes from users on O365.

I disabled ALL licenses on several users. Web portal showing no licenses on them.

(Get-MsolUser -UserPrincipalName <username>').licenses showing there's no licenses as well.

But when I run Disable-Mailbox <username> -IgnoreLegalHold -PermanentlyDisable

It says

Cannot Disable-Mailbox for 'John Doe' because this user has a valid license.

I tried to remove licenses via GUI and via Powershell. Result is the same.

Why is could think they have licenses?

Any Ideas ?

3 Replies

The Disable-Mailbox cmdlet is not supposed to be used in such scenarios - if the user is licensed, the "correct" way to deprovision the mailbox is to remove the Exchange license from it, which triggers the deprovisioning workflow.

 

In addition, if the mailbox was put on any type of hold (since you used the -IgnoreLegelHold parameter), removing the license automatically puts the corresponding user in an error state and halts any sync with ExODS, which probably explains why the change in license isn't being reflected on ExODS side.

@Andy_Bonddid you ever resolve this issue?  I am having the same problem, users don't have licenses but attempting to remove the mailbox results in an error saying that they do.

 

 

@MCortezI found the issue two months later, it was retention policy, which didn't allow me to remove mailbox. I have disabled the policy and it allowed me to remove the mailbox.