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.
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".