Reputation: 49
CMS Sitecore 8.2. I have many object in recycle bin - 500k. I want to remove object in bin with powershell. I can't find scripts ps in google. Help me pls to solve problem.
Upvotes: 1
Views: 1031
Reputation: 27132
You can use Remove-ArchiveItem
command.
E.g. to remove item with ID "{1BB32980-66B4-4ADA-9170-10A9D3336613}"
from Recycle Bin, use:
$database = Get-Database -Name "master"
$archiveName = "recyclebin"
$archive = Get-Archive -Database $database -Name $archiveName
Remove-ArchiveItem -Archive $archive -ItemId "{1BB32980-66B4-4ADA-9170-10A9D3336613}"
To remove all the items from Recycle Bin, use:
$database = Get-Database -Name "master"
$archiveName = "recyclebin"
$archive = Get-Archive -Database $database -Name $archiveName
Get-ArchiveItem -Archive $archive | Remove-ArchiveItem
You can find those and more examples in the documentation here: https://doc.sitecorepowershell.com/appendix/common/remove-archiveitem
Upvotes: 1