user263980
user263980

Reputation: 49

How to remove objects in recycle bin Sitecore CMS with powershell scrript?

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

Answers (1)

Marek Musielak
Marek Musielak

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

Related Questions