A while back I had created a command which allowed you to set the navigation elements/nodes for a given site. The command allowed you to also set a couple of basic switches that appear on the Site Navigation Settings page (Home > Site Settings > Modify Navigation) but it didn't allow you to set all the flags. I thought about possibly modifying this command to allow all the flags to be set but then decided it would introduce some complexities that were just not worth introducing.
In the end I decided to create a new command, gl-setnavigationsettings, which would allow you to set all the values found on the above mentioned page with the exception of the navigation nodes themselves. Fortunately, the code for this was extremely simple (especially considering I already had chunks that I could use thanks to the other command I had created). The code simply sets properties on the PublishingWeb object based on parameters provided by the user:
The syntax of the command can be seen below:
C:\>stsadm -help gl-setnavigationsettings stsadm -o gl-setnavigationsettings Sets the navigation settings for a web site (use gl-setnavigationnodes to change the actual nodes that appear). Parameters: -url <site collection url> [-showsubsites <true | false>] [-showpages <true | false>] [-sortmethod <automatic | manualwithautomaticpagesorting | manual>] [-autosortmethod <title | createddate | lastmodifieddate>] [-sortascending <true | false>] [-inheritglobalnav <true | false>] [-currentnav <inheritparent | currentsiteandsiblings | currentsiteonly>]Here's an example of how to set various settings on a given web:
stsadm -o gl-setnavigationsettings -url "http://intranet/sitedirectory" -showsubsites true -showpages true -sortmethod automatic -autosortmethod title -sortascending true -inheritglobalnav false -currentnav currentsiteandsiblings