I've moved my blog to!. Please update your links. This blog is no longer in use--you can find all posts and comments at my new blog; I will no longer be posting to this site and comments have been disabled.

Monday, September 17, 2007

Set Site General Settings

This command, gl-setsitegeneralsettings, is the replacement command for the gl-setsitecollectiontitle command. It's basically just that command renamed and reworked to make it much more capable. The original command only allowed you to set the title of a site collection - this was just way to limiting so I changed it so that you could also set the description and the logo and this can now be done to any site, not just the top level site collection.

In most cases you're going to want to use master pages to set the look and feel so I don't see this as being too useful but I just couldn't leave the old command as it was (sorry to anyone who had that command as part of a script but I think you'll find this one much better). One of the nice changes I made was the ability to recurse the logo changes to all sub webs. To take this further, if you don't actually provide a logo and alt text to the command but you do provided the recurse switch then it will recurse the settings for the specified site down to all children sites. I could see something like this being put into a timer job to help keep all sub-sites with the same logo.

The syntax of the command can be seen below:

C:\>stsadm -help gl-setsitegeneralsettings

stsadm -o gl-setsitegeneralsettings

Sets the general properties of a site.

        -url <site url>
        [-title <site title>]
        [-description <description for the site>]
        [-logourl <site logo url>]
        [-logoalttext <alternative text for logo>]
        [-recurselogochanges (recurse logo changes to all sub-sites)]

Here’s an example of how to set all the general properties and recurse the logo changes down to all sub-sites:

stsadm –o gl-setsitegeneralsettings –url "http://intranet/" –title "Corporate Portal" -description "Edfinancial Services Corporate Portal" -logourl "/_layouts/images/edfinancial.gif" -logoalttext "Edfinancial Services Logo" -recurselogochanges

Here’s another example showing how to recurse all logo changes from the specified site using whatever is set at that site rather than specifying it explicitly:

stsadm –o gl-setsitegeneralsettings –url "http://intranet/" -recurselogochanges


Kaj Bonfils said...

Great tools.. They have helped a lot!!!! I have an issue though.

I have configured two sites...
http://localhost and http://localhost:81

When I call

stsadm -o gl-setsitegeneralsettings -url http://localhost:81 ....

the settings are applied to http://localhost. It seems that the :81 is ignored.

Any clues?

Gary Lapointe said...

Not really sure why it would behave like that. Might be an AAM issue. I'd have to look into how the SPSite object is loading up - you might try a simple thing like making sure there's a trailing slash (/) or see if it behaves the same when using a sub-site.

Eric said...

Wow. This just saved a couple of hours of work this morning. I thought the stsadm gl tools might let me write a script to recursively set the site logo, but I had no idea it was baked right in! Thanks!