I was faced with a situation where I had 17,020 users that synced up into Office 365 but my Office 365 license was like about 5…
So one of the quickest paths I took was to fire up PowerShell and remove all users that did not have a license.
These are the steps I took to get the job done:
Connect-MsolService
Type in your Office 365 Global Admin credentials:
Get-MsolUser -all | Where-Object {$_.isLicensed -ne "true"} | Remove-MsolUser -Force
Anyway, curious to see the rate it deleted the users, I thought of monitoring the process by opening another PowerShell window and ran this:
Connect-MsolService
Type in your Office 365 Global Admin credentials
Get-MsolUser -All | measure
Turns out the above command took three minutes to run (around 15,600 users) and deleted approximately 36 users per minute. The above command, will progressively run faster as the user count goes down.
Once I’m done, I’ll be configuring up the DirSync version of Forefront Identity Manager 2010 R2 (FIM) to selectively sync a few of the choicest users in my AD infrastructure.
🙂