Friday, August 12, 2016

Reset sharepoint site navigation through powershell

If a sharepoint site can not be accessed through browser for some reason, the easiest way to reset site navigation to default settings is by using powershell script like so:

Write-Host -ForegroundColor White "Set the SharePoint 2010 and 2013 Navigation Settings on Sites"

#Set the Site Collection
$SPSite = Get-SPSite -Identity "http://siteurl/"

#Go through each site in the Site Collection
foreach ($SPWeb in $SPSite.AllWebs)
{
    $navSettings = New-Object Microsoft.SharePoint.Publishing.Navigation.WebNavigationSettings($SPWeb)
    $navSettings.ResetToDefaults();
    $navSettings.GlobalNavigation.Source = 1
    $navSettings.Update()

    Write-Host "Navigation updated successfully for site $url"

}


References:
https://jespermchristensen.wordpress.com/2013/01/16/set-sharepoint-2013-navigation-settings-from-powershell/

http://sharepoint.stackexchange.com/questions/29449/powershell-script-to-update-navigation-globalincludesubsites-not-applying-change

https://social.technet.microsoft.com/Forums/office/en-US/6b9e8542-a410-4c6f-89a0-532b0a0e831a/powershell-script-to-set-current-navigation-in-navigation-settings?forum=sharepointadmin

https://social.msdn.microsoft.com/Forums/en-US/2f6aec24-0117-4f58-a82d-115f3ce29c6b/restore-managed-navigation-enabled-site-collection-in-a-new-sharepoint-farm?forum=sharepointdevelopment

No comments:

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...