We can use any of the below PowerShell scripts to unlock the all items.
Get-ChildItem master:\content -rec -Language * |
Where-Object { $_.Locking.GetOwner() -eq "sitecore\USERNAME" } |
% { $_.Locking.Unlock() }
or
$script:counter = 0
$script:unlockedCounter = 0
$owner = $user.Replace("\","\\")
function Unlock-Item-And-Descendants {
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[Sitecore.Data.Items.Item]$item
)
if ($item["__Lock"] -match $owner) {
Write-Host "Unlocking" $item.Paths.ContentPath ":" $item.ID
Unlock-Item $item
$script:unlockedCounter++
if ($script:unlockedCounter % 500 -eq 0) {
Write-Host "$script:unlockedCounter items unlocked"
}
}
$script:counter++
if ($script:counter % 500 -eq 0) {
Write-Host "$script:counter items reviewed"
}
foreach ($childItem in $item.Children) {
Unlock-Item-And-Descendants -Item $childItem
}
}
Unlock-Item-And-Descendants -Item $root
Write-Host "Unlocked $script:unlockedCounter total items"
Write-Host "Reviewed $script:counter total items"
Comments
Post a Comment