6

I have a multisite Sitecore instance and I would like to get all locked items from all different sites and users and unlock them, is it possible to do this job using Sitecore Powershell Extensions?

6

Have a look here in the SPE book regarding the Unlock-Item command.

Example: The following will unlock the direct descendants of the home item.

Get-ChildItem -Path master:\content\home | Unlock-Item -PassThru

You should update the path to be specific to the tenant you wish to unlock. Add the -Recurse switch to the Get-ChildItem command to run through the whole tree. You may find Where-Object helpful when filtering for specific templates.

Example: The following recurses the tree, filters for a specific template, and then unlocks.

Get-ChildItem -Path master:\content\home -Recurse | 
    Where-Object { $_.TemplateId -eq "{ENTER_YOUR_TEMPLATE_GUID}"} | 
    Unlock-Item -PassThru
2

Sitecore PowerShell Extensions also has a built-in report to find these locked items. This is something very useful when you have not interest in writing a line of code.

Navigate to to Reporting Tools -> PowerShell Reports -> Content Audit

Locked Items Report

Immediately following you will be presented with a dialog for selecting where to begin the search, such as the desired tenant, and either all or a specific locked user.

Locked Items Filter

You can customize the report to have an Unlock action. This would be handy if you want to provided delegated administration for users that you want to run the report but not be able to manage users.

Report with optional action

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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