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:
- Recover Deleted User account.
- 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.
1. Restore Deleted User account
1.1 – Restore Deleted User account by using the User UPN
Restore-MsolUser –UserPrincipalName <User UPN> -AutoReconcileProxyConflicts -NewUserPrincipalName <User UPN>
|
Restore-MsolUser -UserPrincipalName user1@o365info.com -AutoReconcileProxyConflicts -NewUserPrincipalName user1@o365info.com
|
1.2 – Restore Deleted User account by using the User GUID
Restore-MsolUser –ObjectId <GUID> -AutoReconcileProxyConflicts -NewUserPrincipalName
|
Restore-MsolUser -ObjectId b9e82087-ad92-4632-a219-d779c29d2edd -AutoReconcileProxyConFLicts -NewUserPrincipalName user1@o365info.com
|
2. Display information
2.1 – Display a list of ALL deleted User accounts
Get-MsolUser -ReturnDeletedUsers | FL UserPrincipalName,ObjectID
|
2.1 – Display information about Specific deleted User account
Get-MsolUser –ReturnDeletedUsers –SearchString <User UPN>| FL UserPrincipalName,ObjectID
|
Get-MsolUser –ReturnDeletedUsers –SearchString User1@o365info.com | FL UserPrincipalName,ObjectID
|
3. Delete (Remove) User account from the Recycle bin
3.1 – Delete (Remove) Specific user account from the Recycle bin
Remove-MsolUser -ObjectId <GUID> -RemoveFromRecycleBin –Force
|
Remove-MsolUser -ObjectId b9e82087-ad92-4632-a219-d779c29d2edd -RemoveFromRecycleBin –Force
|
3.2 – Delete (Remove) ALL user account from the Recycle bin (Bulk Mode)
Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin –Force
|
Commenti
Posta un commento