Manage Office 365 Recycle bin by using PowerShell


Office 365 Active Directory provides the option to recover office 365 deleted user account.
Each of “deleted user account” will be saved in the Active Directory Recycle bin for 30 days.
When we delete a user account, the operation described as “Soft Delete” because the user account is not deleted completely.
Management tasks relating to soft delete are:
  1. Recover Deleted User account.
  2. Delete (remove) Deleted user account – delete a user object from the Active Directory Recycle bin (describes as Hard Delete). This option is suitable for scenarios in which the deleted user account “Blocks” creation of new user account with an identical display name or UPN.
In the article, we review the management of the deleted account by using PowerShell commands.




1. Restore Deleted User account


1.1 – Restore Deleted User account by using the User UPN





1.2 – Restore Deleted User account by using the User GUID







2. Display information


2.1 – Display a list of ALL deleted User accounts




2.1 – Display information about Specific deleted User account







3. Delete (Remove) User account from the Recycle bin


3.1 – Delete (Remove) Specific user account from the Recycle bin





3.2 – Delete (Remove) ALL user account from the Recycle bin (Bulk Mode)



PowerShell

Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin Force

Commenti

Post popolari in questo blog

Come e quando smantellare i server Exchange in una distribuzione ibrida

Manage Room Mailbox by using PowerShell

How to reset an Office 365 install to the initial activation/install state