Home Blog Restoring OneDrive for Business Deleted Users - Best Practice

Restoring OneDrive for Business Deleted Users - Best Practice

 2021/04/11   Microsoft Cloud Solutions   714 visit(s)

download    

 Karim A. Zaki

Restoring OneDrive for Business Deleted Users KSA .jpg

Today’s blog explores two different retention policy scenarios for OneDrive For business. The first one is accomplished from Compliance center search contents and the second is from SharePoint admin center, so with no further ado, let’s dive right in.

The table below shows a comparison between the retention and configuration capabilities of compliance center and SharePoint.

Retention Policy from Compliance Center

Create and configure retention policies to automatically retain or delete content - Microsoft 365 Compliance | Microsoft Docs

The security and compliance center can be used to retain OneDrive Data, often for compliance reasons, noting that the data will be retrieved using content search. This method helps you accomplish the following:

  • Comply proactively with industry regulations and internal policies 
  • Reduce your risk in the event of litigation or a security breach
  • ·      Help your organization to share knowledge effectively.

 

Data will be retrieved using the search content in the compliance center. 

Retention Policy from SharePoint Admin Center (Highly Recommended)

A user's OneDrive URL is based on their username. For example, https://domain-my.sharepoint.com/personal/user1_domain_com.

The image below shows how the result looks like after restoring the data.

Set the OneDrive retention for deleted users

Go to OneDrive admin portal

OneDrive for Business Admin Preview

Enter the number of days you want to keep the OneDrive files in the Days to retain files in OneDrive after a user account is marked for deletion box.

The minimum value is 30 days and the maximum value is 3650 days (10 years).

This is the process of deletion

OneDrive retention and deletion - OneDrive | Microsoft Docs

When the account is deleted, the account deletion is synced to sharepoint and the OneDrive Cleanup job runs OneDrive Marked for deletion the user will appear in the deleted users for 30 days

Note

Retention policies always take precedence to the standard OneDrive deletion process, so content included in a policy could be deleted before 30 days or retained for longer than the OneDrive retention.

Restore the Data.

Let’s start with the restore process by installing SharePoint PowerShell. The following is all the commands needed:

#install sherepoint online Module

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

# connect to your sharepoint tenant

Connect-SPOService -Url https://mydomain-admin.sharepoint.com

# get list of deleted users URL

Get-SPODeletedSite -IncludeOnlyPersonalSite | FT url

#restore the user

Restore-SPODeletedSite -Identity  https://yourdomain-my.sharepoint.com/deleteduser/deleteduser_yourdomain_com

# assign admin to open

Set-SPOUser -Site  https://yourdomain-my.sharepoint.com/deleteduser/deleteduser_yourdomain_com -LoginName admin@yourdomain.com -IsSiteCollectionAdmin $True

 

# When you permanently delete a OneDrive, you will not be able to restore it.

Remove-SPOSite -Identity  https://yourdomain-my.sharepoint.com/deleteduser/deleteduser_yourdomain_com

Remove-SPODeletedSite -Identity  https://yourdomain-my.sharepoint.com/deleteduser/deleteduser_yourdomain_com

 

The following is an explanation of each command

Download SharePoint Online Management Shell from Official Microsoft Download Center

Connect-SPOService -Url Connect-SPOService -Url https://yourdomain-admin.sharepoint.com

Now connect to know if the user’s data is available or not

Get-SPODeletedSite -Identity

A user's OneDrive URL is based on their username.

For example, https://yourdomain-my.sharepoint.com/personal/user1_contoso_com

Lets say you don’t know his URL then run the following command to get all deleted users

If his username appears then it can be restored

Get-SPODeletedSite -IncludeOnlyPersonalSite | FT url

Then restore onedrive to active state

Restore-SPODeletedSite -Identity

Assign administrator to view the data

Set-SPOUser -Site -LoginName -IsSiteCollectionAdmin $True

After you finish remove then delete

Remove-SPOSite -Identity

Remove-SPODeletedSite -Identity

Restore a deleted OneDrive - OneDrive | Microsoft Docs

We hope we've managed to help you out!

Karim A. Zaki

Ctelecoms Team






Search the Blog

Subscribe Blog

Solutions

security-icon

IT & Cyber-Security Solutions

Best-in-class cyber security solutions to ...

microsoft-icon

Microsoft Cloud Solutions

Explore Ctelecoms extensive selection of ...

capling-icon

Datacenter Solutions

Solve issues, streamline operations, promote ...

backup-icon

Cloud Backup & Disaster Recovery Solutions

Keep your data, apps, emails and operations ...

capling-icon

Computing & Hyper-converged Infrastructure Solutions

Take your IT infrastructure to the next level ...

networking-icon

Unified Communications & Networking Solutions

Ensure you are securely connected with all ...

meraki-icon

Meraki Networking Solutions

Quickly deploy a reliable, secure, cloud-managed ...