Master Page stsadm commands

This blog posting applies to Microsoft Office SharePoint Server 2007.

Have you ever wanted to use stsadm to view or manipulate a site's master page?  Unfortunately there are no default commands to do so.  But stsadm is easy--and fun, some might even argue--to extend.

I wrote a sample project that you can use to perform the following functions:

  • stsadm -o ShowMasterPage -url <site url>

  • stsadm -o SetMasterPage -url <site url> -masterpageurl [<page url> | Parent]

    This can come in very handy for troubleshooting and fixing problems with some master page deployments.  The code is on MSDN's new "Code Gallery" which is very much like CodePlex, but designed for the smaller, quicker samples that don't need to be full-blown collaborative projects.  I thought I'd try it out.

Download: https://code.msdn.microsoft.com/masterpagecommands.