Skip to main content

2 posts tagged with "OneDrive"

View All Tags

Archiving OneDrive to SharePoint with PowerShell and Microsoft Graph

· 9 min read

When someone leaves an organisation, their OneDrive can contain files that the rest of the team still needs. Downloading those files and uploading them to SharePoint works, but it isn't a particularly enjoyable way to spend an afternoon - especially when you have several accounts to deal with.

Microsoft Graph can copy the content directly between OneDrive and SharePoint without sending the files through your computer. These scripts wrap that process so you can archive one user's content, or queue a batch and check its progress later.

Recursively remove a folder from OneDrive with PowerShell

· 2 min read

Did you know, when you have a retention policy configured for OneDrive in Microsoft 365 you lose the ability to recursively delete folders. The OneDrive client often handles this by recursing through the folder tree to remove the online copies but sometimes that doesn't work and in those cases you can end up stuck with a folder tree that you would have to manually recurse to remove the offending folders by first emptying them entirely before OneDrive will let you delete them.

Well that's never going to happen ;-)

Enter PowerShell.

:::info Required Modules You'll need the PnP.PowerShell module for this script. Install with Install-Module 'PnP.PowerShell' :::