Forum Discussion
Andy_Bond
Feb 19, 2019Copper Contributor
Can't remove office 365 licenses
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 ?
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.