How can you restore files deleted by a particular user within a specific time? using powershell
Please advise
How can you restore files deleted by a particular user within a specific time? using powershell
Please advise
Sorry, I usually prefers date1 be the older date and date 2 the newer date. If you set it this way, greater than date "-gt" and Less than date "-lt" dates the other way around between "date1" and "date2".
Below is my sample script for you:
$date1=get-date("08/21/2020")
$date2=get-date("08/11/2020")
Connect-PnPOnline https://tenant.sharepoint.com/sites/michael
Get-PnPRecycleBinItem | ? {($_.DeletedDate -gt $date2 -and $_.DeletedDate -lt $date1) -and ($_.DeletedByEmail -eq 'john@contoso.com')} | Restore-PnpRecycleBinItem -Force
Reference: restore-recycle-bin-sharepoint-online-with-powershell
powershell-recursive-folder-restore
If the response is helpful, please click "Accept Answer" and upvote it.
Please help the PowerShell command is performed. but in the backend, the files are still in the recycle bin
here is a screenshot attached. also, i have tried it with both modules at a time with one but still the command runs but the file is still in the bin
Install-Module -Name SharePointPnPPowerShellOnline
Install-Module -Name PnP.PowerShell
although this works
Get-PnPRecycleBinItem | Where { $_.DeletedByEmail -eq "amit@mstestgigmosamyad.onmicrosoft.com"} | Restore-PnpRecycleBinItem -Force
but cant customize dates
Sorry, I usually prefers date1 be the older date and date 2 the newer date. If you set it this way, greater than date "-gt" and Less than date "-lt" dates the other way around between "date1" and "date2".
Hi Mike
I notice the date is in US format will I need to amend it to UK format for this to work on my SPO site?
Thanks
6 people are following this question.