Example: The following removes an item link followed by removing the item. Originally posted here.
# Crafted by DylanfunctionRemove-ItemLink {param([Item]$item) $linkDb = [Sitecore.Globals]::LinkDatabase $links =Get-ItemReferrer-Item $item -ItemLinkforeach($link in $links) { $linkedItem =Get-Item-Path master:\ -ID $link.SourceItemID $itemField = $linkedItem.Fields[$link.SourceFieldID] $field = [Sitecore.Data.Fields.FieldTypeManager]::GetField($itemField) $linkedItem.Editing.BeginEdit() $field.RemoveLink($link) $linkedItem.Editing.EndEdit() }}# Example usage: delete items along with their references that have passed a certain date defined by a 'date' field$today =Get-Date$todayIsoDate = [Sitecore.DateUtil]::ToIsoDate($today)$query ="/sitecore/system/Modules/Mysite/Service Schedules/*[@date < '$($todayIsoDate)']"$itemsToDelete =Get-Item-Path master: -Query $queryforeach($item in $itemsToDelete) {Write-Host"Cleaning up $($itemsToDelete.Paths.Path)"Remove-ItemLink-Item $itemRemove-Item-Path $item.Paths.Path}