Mundy

IT Knowledge Base

User Tools

Site Tools


Sidebar

Contact me at dan@mundy.co for any feedback or suggestions.


My other sites:

Search all my sites:

remove_deleted_users_in_office_365

Remove deleted users in Office 365

Run the “Windows Azure Active Directory Module for PowerShell” on the machine with dirsync (not sure if you have to download that one or if it's installed with dirsync. If you need to download it, it's here)

Connect-MSOLService
get-msoluser
get-msoluser -ReturnDeletedUsers | select UserPrincipalName, ObjectId

The second command above shows a list of all deleted users.

To permanently delete one of the results, use the returned ObjectID in above statement in the Remove-MsolUser statement:

Remove-MsolUser -RemoveFromRecycleBin –ObjectId ObjectId -force

To permanently delete all of the users in the recycle bin, run:

Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser –RemoveFromRecycleBin -Force
remove_deleted_users_in_office_365.txt · Last modified: 2018/04/09 09:56 (external edit)