简体   繁体   中英

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.

You can use Remove-ArchiveItem command.

Eg 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM