Not wanting to have to hand edit my custom navigation links between lab, test, and production I wrote a little script to do it for me.   It takes as input an xml file that defines the title and url of each link (I haven’t added support for external links yet but if needed, it would be an easy change).

The only trick, other than initially finding the SearchNav property, was that when you first create the  SSNavigationNode the title isn’t visible on the property until you call AddToSearchNav.   Oh and you can’t change the url of an existing node.  You need to delete and re-add.

Now that I’m writing this I realize that I haven’t handled making sure the order is kept in sync with the config file… but that’ll have to wait until another day.

You can download the script from Script Center: [Initialize-SPSearchNavs.ps1]