Remove Users, Contacts and Groups from Office 365

I recently had to decommission an Office 365 account that required removing all contacts, groups and 3000+ unlicensed users, and then purging the deleted users.

First, DirSync was disabled to avoid conflict with any accounts that have Active Directory as their source of authority.

Second, to run deletions in bulk we must connect to Office 365 via the Azure AD PowerShell module.

Next, and after a little review of the users, the following commands where run.

To remove all unlicensed users from Office 365…

Get-MsolUser -All -UnlicensedUsersOnly | Remove-MsolUser -Force

To remove all contacts from Office 365…

Get-MsolContact -All | Remove-MsolContact -Force

To remove all groups from Office 365…

Get-MsolGroup -All | Remove-MsolGroup -Force

Lastly, all users that had been removed were purged from Office 365.

 

Related Articles:

Reference(s):

Advertisements

One thought on “Remove Users, Contacts and Groups from Office 365

  1. Pingback: Remove Users, Contacts and Groups from Office 365 | Cloud Evangelist

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