【问题标题】:How to remove objects in recycle bin Sitecore CMS with powershell scrript?如何使用 powershell 脚本删除回收站 Sitecore CMS 中的对象?
【发布时间】:2020-11-06 23:14:51
【问题描述】:

CMS Sitecore 8.2。我在回收站中有很多对象 - 500k。 我想用 powershell 删除 bin 中的对象。我在谷歌中找不到脚本 ps。 请帮我解决问题。

【问题讨论】:

    标签: c# asp.net powershell sitecore


    【解决方案1】:

    您可以使用Remove-ArchiveItem 命令。

    例如要从回收站中删除 ID 为 "{1BB32980-66B4-4ADA-9170-10A9D3336613}" 的项目,请使用:

    $database = Get-Database -Name "master"
    $archiveName = "recyclebin"
    $archive = Get-Archive -Database $database -Name $archiveName
    Remove-ArchiveItem -Archive $archive -ItemId "{1BB32980-66B4-4ADA-9170-10A9D3336613}"
    

    要从回收站中删除所有项目,请使用:

    $database = Get-Database -Name "master"
    $archiveName = "recyclebin"
    $archive = Get-Archive -Database $database -Name $archiveName
    Get-ArchiveItem -Archive $archive | Remove-ArchiveItem
    

    您可以在此处的文档中找到这些以及更多示例:https://doc.sitecorepowershell.com/appendix/common/remove-archiveitem

    【讨论】:

    • 谢谢马雷克。你知道为什么会出现这个错误吗? Get-ArchiveItem :术语“Get-ArchiveItem”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确并重试。其他步骤不错.....
    • 我不知道。官方文档说它在那里doc.sitecorepowershell.com/appendix/common/get-archiveitem
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-06
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 2022-10-17
    相关资源
    最近更新 更多