

The full script is available to download here from GitHub. We use cmdlets from the SharePoint Online and PNP PowerShell modules to perform OneDrive file operations with the permissions needed to execute these tasks. To do this, we use PowerShell to group the files by user OneDrive address and allow the reviewer to select one, some, all, or none of the files for removal. The next task is to present the export data from the CSV file in a useable fashion. Reviewing Findings and Selective OneDrive Removal

Now that the search is completed and report downloaded, we can utilize that CSV file to determine which OneDrive files to delete. Once the report is exported, we can download the CSV file generated: Figure 2: Click on Download report to retrieve the generated CSV file.ĭownloading the report requires a key (Figure 3), which can be copied from the search details and pasted into the Microsoft Export utility: Figure 3: Downloading the report requires a key. Once you are happy that the search finds the right items, generate a report of the results by selecting ‘Export Report’: Figure 1: Select the ‘Export Report’ option to generate and produce a report. Once the search completes, we can examine the preview results. Depending on the number of search locations, this could take some time to complete. The search starts and creates a preview set of results.

Enter “Exchange” as a keyword for the search and choose the target OneDrive search locations. In the Microsoft 365 Compliance Center, go to the Content search section and create a new search.
