SharePoint 2013–Branding the Suite Bar via PowerShell

The Suite Bar in SharePoint 2013 is a great place to apply some customised links and can be configured at the Web Application level so that any sub-site renders in a standardised manner. So what’s the safest and quickest way to edit this? Simple, use my old faithful friend, PowerShell!
In this example, I will be using the Web Application http://sharepoint and the CSS class ms-core-suiteLink-a, obviously you just need to substitue with the variables you need for your environment.
First thing we need to do is expose the current configuration. Afterall, we don’t want to set something without having something to roll back to!

$webApp = Get-SPWebApplication http://sharepoint
$webApp.SuiteBarBrandingElementHtml

Now, to overwrite it all you need to do it build a HTML string such as this:

$html = "<div class='ms-core-brandingText'><a class='ms-core-suiteLink-a' href='http://sharepoint'>SharePoint</a></div>"

And finally set and update the property:

$webApp.SuiteBarBrandingElementHtml = $html
$webApp.Update()

I shouldn’t have to say it but there is an obvious risk – this is a Web Application wide setting, check the HTML syntax is valid. If it’s not, every page in every Site Collection might fail to load.

About the author