Show Pages in Global Navigation

06/12/2012 12:34

$siteUrl="https://server/sitecollection"

# check to ensure Microsoft.SharePoint.PowerShell is loaded
    $snapin=Get-PSSnapin | Where-Object {
       $_.Name -eq 'Microsoft.SharePoint.Powershell'}
       if ($snapin -eq $null) {
       Write-Host "Loading SharePoint Powershell Snapin"
       Add-PSSnapin "Microsoft.SharePoint.Powershell"
     }
 
Start-SPAssignment -Global    
$web=get-spweb $siteUrl 

#1. Turn on showing Pages in global navigation
$pubweb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)

#Show subsites
$pubweb.Navigation.GlobalIncludeSubSites = $true;

#Show Pages
$pubweb.Navigation.GlobalIncludePages = $true
$pubWeb.Update();

Stop-SPAssignment -Global