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.

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.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “Add a Link to SharePoint Top Navigation Menu or Quick Launch using PowerShell

  • Is it possible to set target audience as well?

    Reply
  • Excellent, thank you!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *