Wednesday, 6 September 2017

Update site logo on all SharePoint sites in a site collection

Update site logo on all SharePoint sites in a site collection

Hi there - I used the script below to update the site logo on a bunch of SharePoint Site Collections today - hope it proves useful to you

 ## Set up the variables

$spWeb = Get-SPWeb $SiteURL
$logopath = "C:\Scripts\Logo\logo_SPsites.png"

Write-Host("- Uploading and updating site logo") -ForegroundColor Magenta


## Creating instance of Folder
$spFolder = $spWeb.GetFolder("SiteAssets")

## Getting the file on Disk that we want to upload
$file = Get-Item $logopath

## Uploading the file the the Site Assets library

$null = 
$spFolder.Files.Add("SiteAssets/logo_SPsites.png",$file.OpenRead(),$false)
   

## Set the logo on all webs in the site:      

$sitelogo="$siteurl/$spFolder/ERIS_logo_SPsites.png"

$Site=$SiteURL

$Sites=new-object Microsoft.SharePoint.SPSite($Site)

foreach($web in $Sites.Allwebs) {

$web.SiteLogoUrl=$sitelogo

$web.Update()}


$Sites.Dispose()

###########################################################################

That's it!

No comments:

Post a Comment

SharePoint Information Architecture Diagram

Here is the template I use for Information Architecture designs. It's built using Mindjet and I flesh the nodes out with the low level d...