Monday, April 7, 2014

SharePoint 2013 Change Site Logo Programmatically with PowerShell

We can change SharePoint 2013 site logo by going to : Site Settings >> "Title, Description, and Logo" from SharePoint web user interface:

sharepoint powershell change site logo
Now, Lets change logo for all sites in a site collection through PowerShell to save some time.

SharePoint 2013 change site logo programmatically using PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

#Web URL to update Logo 
$WebURL = ""

#Get the Web
$Web = Get-SPWeb $WebURL

$web.SiteLogoUrl = "/_layouts/15/images/sharepoint-diary-logo.png"  #can be from any library too: "/sites/operations/images/Corp-Logo.png"

Write-host "Logo updated for :"$WebURL
This script changes logo programmatically for a single site.

You can copy the logo file to your each WFE, so that the logo will be retrieved from file system rather from a SharePoint library. The "Images" virtual folder is mapped with "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\IMAGES" in the file system.

Make sure your logo file is accessible by everyone. Users must have read access at least! and it should be approved (if content approvals is ON. Checked-in and published too!). Otherwise, your users may end-up continuous authentication prompts without page loading, when accessing SharePoint sites!

SharePoint 2010 update logo URL using PowerShell for a Site collection:
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

$SiteURL = "http://Your-Site-Collection-URL"

#Get the site collection
$Site = Get-SPSite $SiteURL

 #Iterate through each site in the site collection 
 foreach($web in $Site.AllWebs)
       #sharepoint change logo programmatically 
       $web.SiteLogoUrl = "/relative-path-logo-file" 
This script makes the change in logo for all sites in SharePoint 2010 (or SharePoint 2013).
sharepoint powershell change site logo

SharePoint PowerShell Change Site logo for All sites in a Web Application: 
Lets change logo for entire web application in one liner:
#sharepoint 2010/2013 change logo for all sites 

Get-SPWebApplication "" | Get-SPSite -Limit "All" | Get-SPWeb -Limit "All" |  foreach { $_.SiteLogoUrl=""; $_.update(); Write-host "Changing Logo for:"$_.Url;  }
All of these scripts are valid for SharePoint 2010 also!

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...