How to add a link to the top link bar in SharePoint using powershell

I am going to add the subsite link to the root site top link bar using powershell.



TopLinkBar.png


$site=Get-SPSite "
http://serverName:1111/sites/sample"
$web=$site.OpenWeb("Subsite3")
$nodeColl = $web.ParentWeb.Navigation.TopNavigationBar
$node=New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($web.Title, $web.ServerRelativeUrl)               
$nodeColl.AddAsLast($node)
Ebook Download
View all
Learn
View all