How to delete a link from the top link bar in SharePoint 2010 using PowerShell

I have one root site collection and three subsites. I am going to remove Subsite3 link from the top link bar using powershell.


TopLinkBar.png


$site=Get-SPSite "
http://serverName:1111/sites/sample"
$web=$site.OpenWeb()
$nodeColl = $web.Navigation.TopNavigationBar
[int]$count=$nodeColl.Count                   
while($count -ne 0)
{
  if ($nodeColl[$count-1].Title -eq "Subsite3")
  {
    $nodeColl[$count-1].Delete()
  }
  $count--
}
Ebook Download
View all
Learn
View all