Im writing a powershell script which at the moment is checking an item ID, and if it contains an internal link that is set to anything other then "Active Browser" it will change the Target to this value.
What I would like to do is go through each item in the entire content tree (/sitecore/content/sitename/Home) and also check each child item for all internal links. Again any that are set to "custom" or "Open in new browser" I would like to set the Target to "Active Browser"
Can anyone help with this?
Below is what I have so far
$item = Get-Item master: -ID "{BDC9773C-7329-4C22-9B87-DD74DC25ADAD}"
[Sitecore.Data.Fields.LinkField]$linkField = $item.Fields["insightsLink"]
Write-Host $item.Fields["insightsLink"]
$item.Editing.BeginEdit()
$linkField.Target = ""
$item.Editing.EndEdit()
Write-Host $item.Fields["insightsLink"]
Thank you!