The post SharePoint 2016: Changing logo for all sites in a site collection using PowerShell appeared first on Blog IT.
Hello,
In a SharePoint 2010 to SharePoint 2016 migration project I was recently involved in, I noticed that in the new SharePoint 2016 Portal, the logo URL in all sites was pointing to an invalid URL.
The Problem
The reason for this is that the Logo URL was pointing to a URL in the SharePoint hive (_layouts virtual directory) and the _layouts virtual directory URL has changed from SharePoint 2010 to SharePoint 2016:
- SharePoint 2010 Layouts root virtual directory URL: /_layouts
- SharePoint 2016 Layouts root virtual directory URL: /_layouts/15
The Solution
Since the site collection has a lot of subsites and I would like to avoid having to change the logo URL manually one by one, I built a small PowerShell script that will loop all the sub sites in the site collection and change the Logo URL for each one. Here is the script:
$sitelogo = "/_layouts/15/Images/logo.jpg"
$site = "https://intranet"
$sites = new-object Microsoft.SharePoint.SPSite($site)
foreach ($web in $sites.Allwebs) {
$webUrl = $web.Url
"Changing site logo url at $webUrl"
$web.SiteLogoUrl = $sitelogo
$web.Update()
}
$sites.Dispose()
If you are a SharePoint developer or administrator and want to learn more on how to install a SharePoint 2016 farm in an automated way using PowerShell click here and here.
If you want to know all about SharePoint 2019, the upcoming version of SharePoint Server, click here.
If you are new to SharePoint and Office 365 and want to learn all about it, take a look at these learning resources.
NOTE: This script should also be valid for SharePoint 2013 and SharePoint 2019.
Hope this helps!
Happy SharePointing!
The post SharePoint 2016: Changing logo for all sites in a site collection using PowerShell appeared first on Blog IT.
Top comments (0)