
- CLEAN RECENT ONEDRIVE HOW TO
- CLEAN RECENT ONEDRIVE FULL
- CLEAN RECENT ONEDRIVE CODE
- CLEAN RECENT ONEDRIVE PASSWORD
Step 3 – Allow the operator to not delete the file (are you sure? option) Step 2 – Use the output from Out-GridView to start removing files.Ĭ. Step 1 – Display files with Out-GridViewī.
CLEAN RECENT ONEDRIVE PASSWORD
$Password = Read-Host -assecurestring "Please password for Global Admin account specified above" $GAUPN = Read-Host "Please enter your Global Admin account UPN" Finally, sort the $Table variable by User and store the results in a variable called $SortedResults:
CLEAN RECENT ONEDRIVE CODE
In the code below we ask for the CSV file name, pull key elements (User and File) from the input file and store this data in a variable called $Table. The export file is not sorted or in a format that we can use, so first need to process the data to generate something more usable. Our downloaded CSV file is in a format like that shown below: Figure 4: Sample CSV File from our keyword search. Now, I’m going to highlight some important parts.
CLEAN RECENT ONEDRIVE FULL
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.

Base Content Searchįirst, we need to run a Content Search.
CLEAN RECENT ONEDRIVE HOW TO
This article demonstrates how to use PowerShell to view the set of files, and then select files to remove.Ĭurious as to how you can use PowerShell to manage Conditional Access (CA) policies? Damian reviews the eight cmdlets in this article. The question is how to remove some but not all the OneDrive documents found by a content search.

While you can remove email using a content search action, Office 365 doesn’t include a method to cleanup OneDrive documents found by content searches. Recently, while working on some Content Searches, a question came up on how to perform selective deletion of OneDrive documents found in the searches.
