Way back one of the first commands I created was one which would allow you to set the Master Site Directory (gl-setmastersitedirectory). It turns out that because my company decided to have each division in it's own site collection that I also needed to be able to set the local site directory (http://[host]/_layouts/SiteDirectorySettings.aspx).
This one took me a minute to figure out what was involved as the disassembled code was a bit of a mess. After spending some time with it I realized it was actually quite simple - just a matter of setting some properties on the root SPWeb object. The core code, which identifies the properties that need to be set, is shown below:The syntax of the command, gl-setlocalsitedirectory, can be seen below.
C:\>stsadm -help gl-setlocalsitedirectory stsadm -o gl-setlocalsitedirectory Sets the local, or site collection, site directory. Parameters: -siteurl <site collection url> -url <site directory url> [-enforcelistinginsitedir] [-sitedirentryrequirement <0=none, 1=at least one category, 2=all categories>] [-allowsitecollectioncreation]
Here's an example of how to set the site directory for a given site collection:
stsadm -o gl-setlocalsitedirectory -siteurl "http://intranet/hr" -url "/hr/SiteDirectory" -enforcelistinginsitedir -sitedirentryrequirement -allowsitecollectioncreation