Global Master Page – Sharepoint 2010


I’ve been administering a Sharepoint 2010 farm for only a few months now but have found there are a lot of really cool things you can do with it that isn’t documented very well by Microsoft.

One of those is the use of a Global Master Page.

What Can a Global Master Page Do For Me?

Using a global master page can speed up the process of branding your Sharepoint site. Typically each site and page has its own master page. This is fine if you never need to make any changes. Once all your sites have been deployed, a simple favicon change could take hours depending on how many sites and pages you have, and how comfortable you are with PowerShell.

The PowerShell scripts below are a great way to maintain a single master page per site collection.

Get your master page the way you want it and then utilize one of the below scripts.

*Note: Test all scripts and cmdlets in a development environment before using on your production environment.

Set Master Page for Single Site

$web = Get-SPWeb siteurl
$web.MasterUrl = “masterpageurl”
$web.Update()
$web.Dispose()

Set Master Page for All Sites in Collection

$site = Get-SPSite http://yoursitehere
$site | Get-SPWeb -limit all | ForEach-Object { $_.MasterUrl = “/sites/collaboration/_catalogs/masterpage/yourfilehere.master”;$_.Update() }
$site.Dispose()

Now, if you edit the master page, all sites configured to utilize the new Master Page will be changed.

I would highly recommend you keep a copy of your original v4.master page before modifying and creating your new master page.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s