How can you restore files deleted by a particular user within a specific time using powershell ?

SR VSP 1,221 Reputation points
2020-08-20T19:07:35.967+00:00

How can you restore files deleted by a particular user within a specific time? using powershell

Please advise

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,412 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,785 questions
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,016 Reputation points
    2020-08-21T02:09:47.6+00:00

    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.


1 additional answer

Sort by: Most helpful
  1. sysadmin-T17 1 Reputation point
    2021-03-26T09:57:20.577+00:00

    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

    0 comments No comments