Is it possible to removed broken links using sitecore powershell. I checked the items link in the Navigation > Links and some of them has "Not found: master {GUID}".
Here is the sample code I have that will fetch the links but it will an error because the linkedItem doesn't exist.
$page = Get-Item -Path $SearchParentPath
$links = Get-ItemReferrer -Item $page -ItemLink
# Iterate through referring items
foreach ($link in $links) {
$linkedItem = Get-Item -Path "/sitecore" -ID $link.SourceItemID
if ($linkedItem -eq $null) {
Write-Host "Broken Link $($link.SourceItemID)"
}
}