Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
How to change the SharePoint Site Logo with PowerShell - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

I recently worked with a client who changed from using SharePoint Foundation to SharePoint Enterprise.  One of the changes was to use an actual URL versus the server name.  Obviously, there were a lot of changes that had to be made including changing the URL for the site logo on all of the site collections and Subsites.  Doing this manually is not only time-consuming, but you can never be sure that you got each one.  So, lets take a look at how else we can do this.

Below is some code that should help you with this task.  It is not too pretty, but it will do the job.  The first part is going to display the Site Logo for the site collection in question which is identified by the first $sitename.

$webapp = Get-SPWebApplication http://intranet

foreach ($SPSite in $webapp.sites)

$sitename= "http://bentest"
$site=new-object Microsoft.SharePoint.SPSite($sitename)
foreach($web in $site.Allwebs)
{

write-host $web.SiteLogoUrl

}
$site.Dispose()

Change the site image for all sites in a given Site Collection

$sitename= "http://bentest"
$sitelogo= "http://bentest/site_documents/sitelogo.jpg"
$site=new-object Microsoft.SharePoint.SPSite($sitename)
foreach($web in $site.Allwebs)
{

$web.SiteLogoUrl=$sitelogo

$web.Update()

}
$site.Dispose()

How did I come up with this?  Well, here are some references:

– http://blog.pointbeyond.com/2011/10/28/set-logos-on-all-sharepoint-sites-in-a-site-collection-%E2%80%93-powershell-one-liner/

– http://samirfarid.wordpress.com/2011/12/05/setting-logo-url-of-a-sharepoint-site-collection-using-powershell/

 

(Visited 670 times, 1 visits today)

About the author 

Joshua Davis, DesertedRoad

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.