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:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...