Search Wiki:

Master Page Commands

This is an stsadm extension that provides the following two commands:
  • stsadm -o ShowMasterPage -url <site url>
  • stsadm -o SetMasterPage -url <site url> -masterpageurl [<page url> | Parent]
    • (-defaultmasterurl and -custommasterurl are also supported to set individual master pages. See note below.)
The commands distinguish between MasterUrl and CustomMasterUrl, for regular sites/collections and also publishing sites/collections. Inheritance is supported. This is great for troubleshooting and fixing problems with your master pages.

Windows SharePoint Services defines two types of master pages: the System Master Page and the Site Master Page. Forms and views pages use the System Master Page; publishing pages use the Site Master Page. The CustomMasterUrl attribute tells Windows SharePoint Services which page to use for the Site Master Page. The MasterUrl attribute tells Windows SharePoint Services which page to use for the System Master Page. (from

Last edited Jan 25 2008 at 5:28 AM  by Markarend, version 8
Steveo wrote  Apr 16 2008 at 10:32 PM  
I am getting the following error when running the ShowMasterPage command:
stsadm -o showmasterpage -url http://myserver/mysite

Value cannot be null.
Parameter name: type

Any thoughts? Thanks for writing this. I'm really excited to use it.

testo wrote  Apr 17 2008 at 5:22 AM  
Getting the same problem! Did anyone manage to find a workaround or code fix?


Markarend wrote  Apr 17 2008 at 3:32 PM  
I'll see if I can do a test sometime soon, but am swamped with other things. Did you try to run this in the debugger? Would help to have more information about where the error came from.

Markarend wrote  Apr 17 2008 at 4:09 PM  
If you can't debug, can you run other commands and tell if they give errors too? Try these:
stsadm -o setmasterpage -url <your site url> (but leave off the other parameters to avoid making change, just see error returned)
stsadm -help showmasterpage
stsadm -help setmasterpage

PaulHickman wrote  May 12 2008 at 6:01 PM  
THe problem occurs because the stsadmcommands.masterpagecommands.xml file contains some errors. The class name and assembly name both read "Custom.MasterPageTools" when they should be "Custom.MasterPageCommands". Also the public key token does not match the snk file included in the source. The correct token is 1e847201ce575b4b. If you make these changes, recompile then upgrade the solution it will work.

Also, can I suggest you make the comparision to the "Parent" keyword case insensitive.

P.s. Markarend - sorry for reposting this comment so many times - this site lacks an edit comment button.

erockenbach wrote  Aug 19 2008 at 1:34 AM  
I did the recommendations per Paul's advice and redeployed the .wsp file but I am still recieving the same value cannot be null exception. I also checked the 12\CONFIG directory to make sure my deployment took effect and matched the PK from the .dll deployed in 12\CONFIG\BIN to that of the config file. Did a reboot... still the same exception. :(

Page view tracker