Collaborate, Innovate, Automate

How to Access a Deleted User's OneDrive (While You Still Can)

21 October 2026 SharePoint Governance PNP PowerShell

A staff member leaves the organisation. IT deletes the account in Entra ID. A week later, their manager receives an email saying that the OneDrive can only be reassigned to another staff member for the next thirty days, if the content is needed.

You go to the SharePoint admin center to find their OneDrive, and it isn't there. Not under Active sites, not under Deleted sites, and the user profile search doesn't find them either. The OneDrive is almost certainly still there. The admin center just doesn't show it.

In this post I'll walk through how to get access to a deleted user's OneDrive using PnP PowerShell, what you need before you start, and how to tidy up afterwards.

What You Need Before You Start

Before you run anything, check these.

  • The account must be deleted recently enough. By default, a deleted user's OneDrive is kept for 30 days after the account is deleted. After that, it moves to the recycle bin and is eventually purged. Once it's gone, you can't get it back.
  • You need the right role. SharePoint Administrator or Global Administrator.
  • You need PnP PowerShell and a Client ID. Since the 2024 change, PnP PowerShell needs your own Entra app registration to sign in interactively. If you don't have one, you can create one (see below).
  • You need the OneDrive URL. It's predictable, so you can build it yourself.
  • The person taking over must be able to sign in to SharePoint. If they've never opened SharePoint or OneDrive, adding them as an admin may fail with a "user not found" error.

Why You Can't See It in the Admin Center

In my case, the OneDrive didn't appear in Active sites or Deleted sites, and searching for Jane under user profiles found nothing. As far as I can tell, the user profile search only finds current profiles, and personal sites belonging to deleted users aren't listed in the UI. The site still exists, and you can still reach it with PowerShell.

Step 1: Build the OneDrive URL

A OneDrive URL is their UPN with the dots and the @ replaced by underscores:

jane.smith@tenantName.com becomes:

https://tenantName-my.sharepoint.com/personal/jane_smith_tenantName_com

Watch out for hyphens in the domain. They stay as hyphens. So jane.smith@tenantName-group.com becomes jane_smith_tenantName-group_com.

Step 2: Connect to the Tenant Admin Site

Connect-PnPOnline -Url https://tenantName-admin.sharepoint.com -Interactive -ClientId <your-app-client-id>

$url = "https://tenantName-my.sharepoint.com/personal/jane_smith_tenantName_com"

If you don't have an app registration yet, this creates one. Sign in as a Global Admin to consent:

Register-PnPEntraIDAppForInteractiveLogin -ApplicationName "PnP Admin" -Tenant tenantName.onmicrosoft.com -Interactive

It prints a Client ID to use above. The app needs a redirect URI of http://localhost and delegated SharePoint permissions.

Step 3: Check the OneDrive Still Exists

Get-PnPTenantSite -Identity $url | Select Url, Owner, Status

Mine came back like this:

Url                                                         Owner                      Status
https://tenantName-my.sharepoint.com/personal/jane_smith_...   jane.smith@tenantName.com     Active

Status Active means nothing needs restoring. The Owner column still shows Jane's UPN, which is expected, because they're the primary owner and their account no longer exists.

If it returns an error, check the tenant recycle bin and restore it if it's there:

Get-PnPTenantRecycleBinItem | Where-Object Url -like "*jane_smith*"
Restore-PnPTenantRecycleBinItem -Url $url

If it isn't in either place, it has been purged. Your last option is restoring Jane's account in Entra while they're still in Deleted users (30-day window), then using the normal route to their OneDrive. Delete the account again afterwards.

Step 4: Add the New Owner as a Site Collection Admin

Set-PnPTenantSite -Identity $url -Owners "alex.manager@tenantName.com"

This returns nothing when it works. If it prints an error, the change didn't apply. A "user not found" usually means a typo in the email, or that the person has never signed in to SharePoint or OneDrive.

-Owners adds to the existing site collection admins. It doesn't replace them, and it doesn't change the primary owner. That's why the Owner column still shows Jane afterwards. Don't take that as a sign it failed.

Step 5: Verify It Worked

To list the admins, you connect to the OneDrive itself:

Connect-PnPOnline -Url $url -Interactive -ClientId <your-app-client-id>
Get-PnPSiteCollectionAdmin | Select Title, LoginName, Email

I got this error:

Get-PnPSiteCollectionAdmin: Attempted to perform an unauthorized operation

Being a tenant admin doesn't automatically make you an admin on someone's personal site. The fix is to add yourself first, from the admin connection:

Connect-PnPOnline -Url https://tenantName-admin.sharepoint.com -Interactive -ClientId <your-app-client-id>
Set-PnPTenantSite -Identity $url -Owners "your.admin@tenantName.com"

Then reconnect to the OneDrive and run Get-PnPSiteCollectionAdmin again. You and the new owner should both be listed.

Step 6: Send the URL

Send the new owner the full OneDrive URL. They need to sign in with the same account you added. The URL isn't what grants access, the admin permission is. They won't find it in their own OneDrive or "Shared with me", so send the link directly.

If they get "Access denied" straight after you add them, wait a few minutes and try again, or use a private browser window in case they're signed in with another account.

Step 7: Clean Up

When the new owner has copied or moved what they need, remove the temporary access. Connect to the OneDrive and remove both the new owner and yourself:

Connect-PnPOnline -Url $url -Interactive -ClientId <your-app-client-id>
Remove-PnPSiteCollectionAdmin -Owners "alex.manager@tenantName.com"
Remove-PnPSiteCollectionAdmin -Owners "your.admin@tenantName.com"

Don't leave admin access lingering on a leaver's OneDrive.

The Full Script

Connect-PnPOnline -Url https://tenantName-admin.sharepoint.com -Interactive -ClientId <your-app-client-id>

$url = "https://tenantName-my.sharepoint.com/personal/jane_smith_tenantName_com"

# Check the OneDrive exists
Get-PnPTenantSite -Identity $url | Select Url, Owner, Status

# Add yourself and the new owner
Set-PnPTenantSite -Identity $url -Owners "your.admin@tenantName.com"
Set-PnPTenantSite -Identity $url -Owners "alex.manager@tenantName.com"

# Verify
Connect-PnPOnline -Url $url -Interactive -ClientId <your-app-client-id>
Get-PnPSiteCollectionAdmin | Select Title, LoginName, Email

# Later: clean up
Remove-PnPSiteCollectionAdmin -Owners "alex.manager@tenantName.com"
Remove-PnPSiteCollectionAdmin -Owners "your.admin@tenantName.com"

Why This Matters

  • The clock is ticking. The retention period starts when the account is deleted, not when someone asks for the files. If the manager asks on day 28, you have two days. Check the retention setting under SharePoint admin center → Settings → OneDrive, and extend it if the content needs sorting through.
  • The admin center won't tell you the site exists. If you rely on the UI, you may tell the manager the files are gone when they aren't.
  • Primary owner doesn't change. The new owner is an additional admin. If you need the content to live somewhere permanent, move it to a SharePoint site or the manager's OneDrive rather than leaving it in a deleted user's personal site.
  • Check for holds. If the user was under a Purview retention policy or hold, content may be preserved separately, whatever happens to the site.

For Teams

  • Set the "Days to retain deleted users' OneDrive" value deliberately, rather than leaving the default.
  • Make sure the leaver's manager is set in Entra. It's needed if you want to use the automatic manager access option for OneDrive of deleted users, and it's worth turning on for future leavers.
  • Add a OneDrive step to the leaver checklist, so the request for access comes before the account is deleted, not after.

Cameron Griffiths is a Microsoft 365 consultant based in Valencia, Spain, specialising in SharePoint Online, Power Automate and Microsoft 365 for business. camerongriffiths.com