MessageOps here with another Tech Tip! This time we’re discussing converting user mailboxes by CSV and removing licenses. Enjoy!


Below are scripts to convert user mailboxes and remove the license after they have been converted.


There are four types of mailboxes that you can convert it to. Below is a description of the parameter that can be selected. Typically this method is used during the migration of resource mailboxes to Office 365. In order to have a high success percentage, it’s best to always have the SAM+UPN of the object. That way you can run a script to remove the licenses for these objects. Below is a script example of how to remove a license from users by CSV.

Remove License By CSV:

Import-CSV “C:\temp\Filename.csv” | foreach {Set-MsolUserLicense -UserPrincipalName $_.Users -RemoveLicenses “contoso:ENTERPRISEPACK”} 2>> c:\temp\License-Remove-Logs.txt

Different Type of Parameters:

Type <Regular | Room | Equipment | Shared>

The Type parameter specifies the type for the mailbox. You can use the
following values:

  • Regular
  • Room
  • Equipment
  • Shared


Convert A Single User:

Set-Mailbox -identity usertoconvert -Type shared

Convert User Mailboxes To Resource:

Import-CSV “C:\temp\Filename.csv” | foreach {Set-Mailbox -identity $_.Users -Type $_.Types} 2>> c:\temp\Convert-Logs.txt

CSV Screen Shot Example:

CSV Remove License Example

Was this article helpful?