Downloading a user's OneDrive data

Iron Contributor

Hi all,


In our organization, before we started moving people to OneDrive, we moved the user's home directory to a backup location and deleted the directory from the our storage. This was done with a PowerShell script that would also remove the user completely from active directory.

I need a way to do the same thing for a user that it's data is in OneDrive. I know I can download files from a SharePoint site with the PowerShell SharePoint snap-in. But I want to do this from a computer that isn't a SharePoint server with the SharePoint module. Unless there is another way.


Thanks, Rahamim.

11 Replies

@RahamimL you can make yourself the SiteCollection owner ( You need SharePoint Online Administrator access for this)  of the users oneDrive . Navigate to the users oneDrive and use the OneDrive Sync Client to Sync the user OneDrive content. 

@Maruthi GaddeI want to automate everything via script and not doing it manually. I can give the site ownership to a site via the script. The only problem is how can I download the content?

Why download the content? Just leave it in place and give anyone that needs access access to the document over time. Long as you set a preservation to store it for a long time you are good. Much easier than trying to shift files around and it doesn’t eat into your licensing / storage.
We're talking about a user that left the organization.
We want to move the user's data to a backup tape and we already have a script that does this for users on our local storage. Now we want the script to do the same thing for users in OneDrive.
Yeah and so am I. Why waste the tape and time doing that when you can just mark set OneDrive preservation and keep the data as long as you would tape, in place for 7 years or whatever you wanted and skip that step. You delete the user the data(site) stays for as long as the preservation is set.

@Chris Webbyou have a point there, and I'll have to check that with my boss.

2 questions than:

  1. We're a hybrid environment and we normally build the user in AD with a mailbox and migrate it to 365. we use this way because when the user leaves we migrate the mailbox back to export the mailbox to a PST and backup that file. Can I use preservation the same way?
  2. What happens to a user in 365 when I delete it in AD?
They get marked for deletion in 365 and deleted after 30 days. However if you have the Retention/ preservation policies in place the mailbox / onedrive will stay and you can access them via security and compliance center to search and export any data you might need later. You can also directly access them if needed as well.
And for those who are required to have a tape backup what do you suggest?
Look at security and compliance center. Should be able to search the onedrive and then export that data that’s in it via a applet (use IE) to download everything if you have to have tape. There are also backup vendors that can talk right to 365 and backup to tape too.

@Chris Webb - as far as I know, you can let user's data stay on OneDrive, but then you have to pay for license. If you stop the payment, you lost data in user interface immediately, definitively after retention period.

How this could be done as admin for user who left the organization? When I will go in Admin Console, Compliance, eDiscovery, I wil create there Case in in the Case the search, I can select user for Exchange, but for OneDrive/Sharepoint there isn't possible to select OneDrive, only Sharepoint web collections.


Kind regards


My understanding is that OneDrive that is under a retention policy does not require a license. Our issue is that we are sort of unique as we have several hundred users that are on employed for 6 months to a year and then a year to a year and a half later they come back to do the same job. As far as I know, we can't reassign their OneDrive back to them. One issue I can foresee is that the URL for their OneDrive is based on their user name and when they come back, Generally they get the same user name (FirstName.LastName). My initial thought is to use PS to zip up their OneDrive and store it in SharePoint or on one of our internal servers. Unless someone knows how to reattach their OneDrive to a new account.