I come across this type of need so may time in my entire career of Sitecore Development. Where I need to find the duplicate value in item’s field. I am writing this as note to me for my own future reference. Hopping this will also help my Sitecore community.
$dictionaryItems = Get-Item -Path 'master:' -Query "/sitecore/system/Dictionary//*[@@templateid='{6D1CD897-1936-4A3A-A511-289A94C2A7B1}']" | Select-Object -Property ID, DisplayName, @{Label="DictionaryKey"; Expression= {$_['Key']}}
$uniqueCollection = $null
foreach ($item in $dictionaryItems){
if($uniqueCollection -Contains $($item.DictionaryKey)){
Write-Host "Duplicate Field Value found in item ID $($item.ID)"
}
else{
$uniqueCollection += $item.DictionaryKey
}
}
Happy Sitecore PowerShelling…!!!