Replicate SharePoint Quicklaunch Navigation on Non-Publishing Sites

On our new SharePoint 2013 installation, we had a large amount of links that we wanted to have in the quick launch on each page in a specific site collection. SharePoint allows you to inherit the quicklaunch on publishing sites, but it has no such ability on non-publishing sites. If you have publishing enabled or are willing to enable publishing this link will help you out. We do not have publishing enabled and we did not want it enabled so we needed to come up with another solution. Our quick and dirty solution was to create a PowerShell script that goes through all the webs on a specific SharePoint site collection that creates the same quicklaunch navigation on every page. It works by first clearing the web of any links, and then goes through a lists of links and adds them in the order we desire. If we need to make any changes to the links on all the pages, we edit the links in the script and then run it again. This will replicate the links on all the webs. Here is a version of the script we run:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$site = Get-SPSite "https://yoursite.com/sites/test"
$webs = $site | Get-SPWeb -limit All
foreach($web in $webs){
	$quicklaunch = $web.Navigation.QuickLaunch
    # First clear out anything currently in the quicklaunch
	for($i = $quicklaunch.Count; $i -gt -1; $i--){
		try{$quicklaunch[$i].Delete()}catch{}
	}
    # create nodes and links
	$homenode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Home", "/", $false)
	$quicklaunch.AddAsFirst($homenode)
	$placesnode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Cool Places", "/sites/states", $false)
	$quicklaunch.AddAsLast($fmsnode)
	$nodes = @()
	$nodes += New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Utah","/sites/utah/", $false)
	$nodes += New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Texas","/sites/texas/", $false)
	$nodes += New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Wyoming","/sites/wyoming/", $false)
	$nodes += New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Idaho","/sites/idaho/", $false)
	$nodes += New-Object Microsoft.SharePoint.Navigation.SPNavigationNode("Montana","/sites/montana/", $false)
	$nodes | Foreach {$fmsnode.Children.AddAsLast($_)}
	Write-Host Done adding navigation links on $web.Url
}

The script is simple. The object you may be unfamiliar with is the SPNavigationNode. The parameters are the following:


SPNavigationNode(
	string title,
	string url,
	bool isExternal
)

Here is a link to the SPNavigationNode on MSDN to learn more about this object. I hope you may find some of this useful!