One of the things I needed my upgrade script to do was to set the master site directory. This can be done easily enough using the central admin tool (Central Administration > Operations > Site Directory Settings). I took most of my code from what I disassembled using Reflector. The code itself just grabs a PortalService object which it then uses to set the settings. You also need to get an SPSite and SPWeb object in order to set the settings correctly. The syntax of the command can be seen below.
C:\>stsadm -help gl-setmastersitedirectory stsadm -o gl-setmastersitedirectory Sets the master site directory. Parameters: -url <site directory url> [-enforcelistinginsitedir] [-sitedirentryrequirement <0=none, 1=at least one category, 2=all categories>]
Here’s an example of how to set the master site directory:
stsadm –o gl-setmastersitedirectory –url “http://intranet/sitedirectory/” –enforcelistinginsitedir -sitedirentryrequirement 1
In a later post I’ll be showing how to create the columns for the site directory (involves manipulating the list entry).