In the same development project I mentioned last post we had the need to change the icon of the SharePoint team site in the group's website is located in a site collection. You can edit manually, click Site Settings, "Title, description and icon."
Therefore, I wanted to write a PowerShell script to update all icons in a row.
1 2 3 4 5 6 7 8 9 10 11 12 13 | Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue$siteLogo = "/SiteAssets/logo.png"$rootSite = Get-SPSite $siteUrl$allWebs = $rootSite.AllWebsforeach ($web in $allWebs) { Write-Host "Updating " + $web.Title + " " + $web.Url $web.SiteLogoUrl = $siteLogo $web.Update()} |
As you can see from the above script simply going through all the sections of a whole site collection und "$ siteUrl". The root of the site stores a "logo.png" with the icon in "SiteAssets" library.
The foreach loop is simply updating the SiteLogoUrl each sub-site with the relative URL specified in "siteLogo".
|
SPONSORS:

No comments:
Post a Comment