Tuesday, January 1, 2013

Site logos

Have you ever been working across 10,20,30,100+ sites and needed to to update the logo location for all of them? Below you will find a script that can be used to update every logo for every site collection and web(sub-site).

Similarly, you can use another script to update other object properties. The best way to do this would be to deploy a custom solution and have the solution do it for you. But in lieu of that, here you go.

# Script

$SiteCollections = get-spsite -limit all

foreach ($site in $SiteCollections)
{
    $MainWeb = Get-SPWeb -Identity $Site.Url
    $MainWeb.SiteLogoUrl = “/SiteAssets/logo.png"
    $MainWeb.SiteLogoDescription = “Company Logo"
    $MainWeb.Update()
    Write-Host "Settings image for $mainWeb"
    $MainWeb.Dispose()
        foreach ($web in $site.AllWebs)
        {
            $Web.SiteLogoUrl = “/SiteAssets/logo.png"
            $Web.SiteLogoDescription = “Company Logo"
            $Web.Update()
            Write-Host "Setting image for $web"
        }
}

 

{Kam}

No comments:

Post a Comment