My new script has been added to the Technet Gallery for use in migration scenarios moving to Exchange Online where you want to create mailboxes for batches of users, place the new mailboxes on hold immediately, and then remove the mailboxes all in batches.
I have a lot of projects coming up where I need to move inactive mailboxes to Exchange Online, place them on hold, and then delicense them to free up the licenses for the active mailboxes.
I wrote this script to make this a little easier. It licenses the users in a single column CSV file (with the column name UPN) with whichever license you specify using the -LicenseSku switch.
If you have specified a supporting SKU, such as ENTERPRISEPACK you can use the -Hold switch to apply litigation hold to the newly created mailbox.
You can also then use the -Disable switch to remove the specified license from the users in your CSV file.
You can download the script here https://gallery.technet.microsoft.com/LicenseAndHoldps1-4431f0e0