In SP2013,I want to identify subsites which has custom global navigation.That is subsites which doesn't inherit global navigation from parent.

Is it possible in PowerShell?


I used PortalNavigation.InheritGlobal property to check which subsite has custom global navigation. In the output,if the value is "false", it means the site does not display the same navigation items as the parent site.

The below PowerShell script worked for me:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$webAppURL = "http://WepAppURL"
$resultsarray =@()
# Get all of the users in a web application
$SPWebApp = Get-SPWebApplication $webAppURL
foreach ($SPSite in $SPWebApp.Sites)
 #Go through each site in the Site Collection
 foreach ($SPWeb in $SPSite.AllWebs)
 # get subsites
 $linkObject = new-object PSObject
 Write-Host -ForegroundColor Gray $SPWeb.Url":" -NoNewLine
 #Set the Publishing Web
 $SPPubWeb =   [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($SPWeb)
 Write-Host -ForegroundColor Green $SPPubWeb.Navigation.InheritGlobal
 Write-Host -ForegroundColor Green      $SPPubWeb.Navigation.GlobalNavigationNodes.Count
 $linkObject | add-member -membertype NoteProperty -name "URL" -Value $SPWeb.Url
 $linkObject | add-member -membertype NoteProperty -name "Inherits Global Navigation?" -Value $SPPubWeb.Navigation.InheritGlobal
 $linkObject | add-member -membertype NoteProperty -name "Nodes Count" -Value $SPPubWeb.Navigation.GlobalNavigationNodes.Count
 $resultsarray += $linkObject
 #Dispose the SPWeb object
 $resultsarray| Export-csv E:\File.csv -notypeinformation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.