How to delete a user in Office 365 (hard and soft delete)
Sometimes you want to hard-delete users if, for example, you have duplicate accounts and have started a new synchronization from Active directory. In addition, sometimes it is convenient to do a hard-delete and then restore the mailbox to another user. In this blog a short guide you how to perform a hard-delete in Office 365 via Powershell.
Install the MSOnline module to connect to Microsoft Online
Install-Module -Name MSOnline
Connect to Azure AD via PowerShell
Connect-msolservice
Press your username & password.
Remove your user from Office 365
Retrieve the deleted users via PowerShell
Get-Msoluser -ReturnDeletedUsers
Delete all users that are in -ReturnDeletedUsers?
Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser RemoveFromRecycleBin
Delete only this user?
Get-MsolUser -ReturnDeletedUsers | fl id Remove-MsolUser -RemoveFromRecycleBin -ObjectId 5ed439d0-ffbe-43a3-8f89-e168f07ef66f
The user has been deleted
Subscribe
Login
0 Comments