2013-08-31

Earlier on this community, I started a discussion of “Powerful SharePoint PowerShell Direction” http://goo.gl/DPIr75.  Essentially I’ve been in awe of the direction started by these three blogs: 

  1. Wictor Wilén
    — SharePoint Central Admin Productivity Tip: http://goo.gl/XmvVxg
  2. Ryan Dennis–Customizing the SharePoint 2013 Suite Bar Branding: http://goo.gl/QvYIep
  3. Chris Stretton–Mastering the SharePoint 2013 Suit Bar: http://goo.gl/y8olSi

   

Starting with Wictor’s basic PowerShell Script :

asnp microsoft.sharepoint.powershell
$ca = Get-SPWebApplication -IncludeCentralAdministration | `
?{$_.IsAdministrationWebApplication -eq $true}
$ca.SuiteBarBrandingElementHtml = “<div class=’ms-core-brandingText’>Central Admin: FarmA Production</div>”
$ca.Update()

(asnp -Must mean add PowerShell Snapin–which I handle through the Profile.)

The script essentially puts a visible label on the Central Admin Site of “Central Admin: FarmA Production”.  Wictor alludes to more that can be done-like “Blinking” text. (For Joy! Everyone loves this as much as Flash and Crawling Ants!)

  

Ever been on the Wrong Site and executed the Wrong Command–or am I the only one?
  
(I can remember in my younger days working on a Unix Machine and then shutting it down.  When to my amazement I hear exclamations and expletives from another room:  I had shutdown the wrong machine. Not the last time either! Anyone looking for a good Unix Admin? Shutdowns–No Extra Charge!)
  
We don’t really want our Production Machines to be “the Wrong Place at the Wrong Time” –do we?
  
Oh boy! A script to play with!! (Sometimes I’m such a child!). It Worked! It Worked!:
  
(A key point to remember in Consulting is try not to be too amazed when your demo works–it’s a dead give-away you might not be the guru.)

  
Now where to go? Wouldn’t it be nice to also label all the non-Admin Sites as well.  Maybe get rid of the non-functional “SharePoint” on the Suite Bar.
  
So I came up with the following formulation:

$ca = Get-SPWebApplication | `
?{$_.IsAdministrationWebApplication -eq $true}
$ca.SuiteBarBrandingElementHtml = “<div class=’ms-core-brandingText’>FarmA Production</div>”
$ca.Update()

(Note the first pipe and where clause aren’t really needed since Admin Sites are only included if specified. Hindsight is Precious but hard to muster at first!)


But all was not well in PowerShell Land:

I had angered the forces that be. How dare they!
  
So I ran the following command after piping stuff to check through get-member (not as immediately as you might think):
  
  
The “$ca” variable was a collection (not an individual object) and the command had been assuming a lone object on which it could find properties.  The command need to iterate through the collection.  I need a more “Borg” algorithm to deal with the collective.
(My Shih-Zhu’s Borg name is “So Cuteous“.)
   
Armed with that bit of information I constructed the following Command:
  
  
  
Assuming you use my Glorious “Custom Look”, you get something like this:
  
  
Something to remember and with more hindsight: You could always parameterize this as this as Dennis Ryan did in his function.  To see what this looks likes just put a specific Web Application URL after the “Get-SPWebApplication.”
  
This means you can target a specific Web Application at this point.  I’m betting there’s more specificity that can be derived by using some functions: perhaps, we can target sites or even webs. (Just speculation at this point.)
  
Where am I going with this?
  
I’m glad you ask. This is a “Work in Progress”.  In my next article in this series,  I will demonstrate how to add in a CSS Script and some jQuery Events.  This gives some additional power to immediate branding–perhaps even security monitoring.
  
I want to stress the seeds are here in this article and the articles I’ve referenced.  I, by myself, can’t figure all the possibilities that can be accomplished on SharePoint 2013, I need you to play with this.
  
Powering Through SharePoint 2013,
Stephan

About the author 

Stephan Onisick

Stephan Onisick works as a SharePoint Developer with Analytical Mechanics Associates contracted to the NASA International Space Station in Huntsville, Alabama. He lives in Huntsville with his beautiful wife Janet and 20-month old Shih Tzu named Michael.