OneDrive repair reset and powershell get sharepoint recycle list and export user recycle bin to csv

Reset onedrive on a computer

Run

 

%localappdata%\Microsoft\OneDrive\onedrive.exe /reset

wait

run

%localappdata%\Microsoft\OneDrive\onedrive.exe

powershell get sharepoint recycle list

(Get-SPSite -Identity "[your site collection URL]").RecycleBin | Export-CSV -Path "[file path and name]"

export user recycle bin to csv

https://social.technet.microsoft.com/Forums/en-US/437381fc-e7e7-4bfa-9488-a23cbcfe825a/get-the-recycle-bin-items-which-has-been-deleted-for-past-10-days-and-has-to-be-exported-to-excel?forum=sharepointgeneralprevious

$url="http://sp"

$deleteFrom = -10

$report = "$($dir)\DeletedRecycleBinItems.csv"

New-Item $report -type file -Force | Out-Null

Add-Content $report "Name, Title, Deleted by, Deleted date, Path, File Guid"

$dateNow = Get-Date

$dateDiff = $dateNow.AddDays($deleteFrom)

$site = Get-SPsite $url

$site.Recyclebin | where { $_.deleteddate -ge $dateDiff} | foreach{ Add-Content $report "$($_.LeafName),$($_.Title),$($_.deletedbyname),$($_.deleteddate),$($_.Dirname),$($_.Id)"

}

Comments are closed.