Hi All,
Today's request is to replace the Hyperlink in the navigator bar, as the referenced site URL has changed.
And last but not least, the request is to change this hyperlink to all sites inside the Web App: more than 1800 Site Collection.
This is the used Code:
#----------------------------------------------------------------------
#Below the code to update the topnavigationbar
# for all Site Collection of the mentioned Web Application .
# Author : Marc Mathot
# Date: November 2013
# Author : Marc Mathot
# Date: November 2013
#----------------------------------------------------------------------
$Webs = Get-SPSite -WebApplication "http://SharePoint.Contoso.com" -limit ALL | Get-SPWeb -limit all
Foreach($Web in $Webs)
{
$TN = $Web.Navigation.TopNavigationBar | Where-Object {$_.Title -eq "Landing Page & Wiki"}
if ($TN.url -like "http://SharePoint.Contoso.com*")
{
write-host "Updating $($Web.url)"
“Updating $($Web.url), $($TN.Url)” | out-file D:\temp\LandingPageUpdate.csv -append
$TN.Url = "http://NewSharePoint.Contoso.com/Pages/LandingPageWikiDefault.aspx"
$TN.update()
}
}
#----------------------------------------------------------------------
Also, in parallel, I had to modify the template used to create the new sites into this Web App.
Doing this will avoid having to run this script periodically to correct the changes.
Doing this will avoid having to run this script periodically to correct the changes.
That's all folks
No comments:
Post a Comment