Does anyone know or have a PowerShell script which can remove the checkbox in publication restrictions specific to publication targets for Sitecore items?

We need to achieve (2) as below since some items have checkboxes in certain publication targets in publication restrictions

As per Sitecore documentation:

To restrict all the item versions to be published only to certain publishing targets, on the Targets tab, select the relevant publishing targets. This applies to all versions of the item in all languages.

  1. If you select one or more publishing targets for the item, when you publish, the item is removed from the publishing targets that you do not select.
  2. If you do not specify any publishing target for the item, the item can be published to any publishing target you choose in the Publish wizard.

Thank you for help in advance!

  • What script have you started with to get you close? Commented Feb 5, 2019 at 16:55
  • We have not started on a script as of yet but we're looking for pointers or any suggestions within Sitecore that would avoid scripting. Commented Feb 5, 2019 at 17:05
  • 2
    The documentation site and Stack Exchange should provide you with some excellent guidance. doc.sitecorepowershell.com/working-with-items Commented Feb 5, 2019 at 17:09

1 Answer 1


I have also came up with the same scenario in my project and I used the below PowerShell script to clean the publishing target. The item property '__Publishing groups' will have the publishing restrictions, clearing this value will remove any publishing restrictions.

$startPath = "/sitecore/content"

New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) 
    foreach($item in Get-ChildItem -Path $startPath -Recurse) 
        $target = $item["__Publishing groups"]
        if (!([string]::IsNullOrEmpty($target)))
            Write-Host "ID - [$($item.ID)]";
            Write-Host "Publishing Target before - [$($item["__Publishing groups"])]";
            $item["__Publishing groups"] = ""
            $item.Editing.EndEdit() | Out-Null
            Write-Host "Publishing Target after - [$($item["__Publishing groups"])]";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.