Bulk Deleting Users from Exchange Online Protection

During an office 365 migration, I was trying to delete all users from an old unused Exchange Online Protection (EOP) tenant so that I could remove the domain then verify it on a new tenant.

I connected by powerShell and tried to use

get-user -filter * | where-object {$_.Name -like "*domain.com"} | Remove-EOPMailUser

but the command ran so slowly, only deleting about 1 user every five minutes, due to throttling on Azure Active Directory (i think)

The following command ran MUCH more quickly, allowing me to delete 2,000 users in about 5 minutes:

get-MSOLuser -all | where-object {$_.Name -match "domain.com"} | Remove-MSOLuser

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s