Just had to do this, and came across this question on my search for a solution.
Pre-requisites:
- You need Windows 7/Windows Server 2008 and .NET (v4.5, although something earlier might work)
- Microsoft Online Services Sign-In Assistant (version 7)
- Microsoft Online Services Module (32 bit, 64 bit)
After installing the above and restarting, open PowerShell
If you used the link created by the installer, proceed to the next step, otherwise you need to import the Microsoft Online Services Module. At the PowerShell prompt:
Import-Module MSOnline
Now, assign your credentials to a variable (these are the login credentials you use to access Office365), a username/password box will appear for you:
$cred = Get-Credential
Connect to the online service and pass your credentials:
Connect-MsolService -Credential $cred
You will need to know the type of license assigned to your user. Find it with:
Get-MsolUser -UserPrincipalName user@example.com | Ft UserPrincipalName,DisplayName,Licenses
Where
user@example.com
is replaced with the user account you are looking for. This will return something like:UserPrincipalName DisplayName Licenses ----------------- ----------- -------- user@example.com John Smith
(Where
example:LITEPACK
is your AccountSkuId)Now, remove the license with:
Set-MsolUserLicense -UserPrincipalName user@example.com -RemoveLicenses "example:LITEPACK"
- Replace the user and license type as appropriate.
- (Note: if you remove the license of a user mailbox, the mailbox and all data contained in the mailbox will be deleted).
At the end of the above, you will still have the original user (with an unlicensed status). Do not remove the user, as that will delete your shared mailbox.