Add a Link to SharePoint Top Navigation Menu or Quick Launch using PowerShell
Requirement: Add a new link to SharePoint Global Navigation (Top Link Bar) or Quick Launch using PowerShell.
Add a link to SharePoint Top Navigation using PowerShell:
Do you want to add links to your SharePoint Top Navigation or Quick Launch using PowerShell? Let me show you how to do just that:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Variables for processing
$WebURL="https://sharepoint.crescent.com/teams/marketing"
$NavigationTitle="Employee Profile"
$NavigationLink="https://peoplesoft.crescent.com/employee/profile.aspx"
#Get the Web
$Web= Get-SPWeb $WebURL
#Get Top Navigation
$TopNavigation = $Web.Navigation.TopNavigationBar
#For Quick Launch, Use: Navigation.QuickLaunch
#Create a New Top Navigation Node
$node = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($NavigationTitle, $NavigationLink, $true)
#Add the Node
$TopNavigation.AddAsLast($node)
#Set the Target Property - Will work only when Publishing features is enabled
$node.Properties["Target"] = "_blank"
$node.Update
You can alter the script to add a new link to all sites in a site collection.