I was recently tasked with installing an update to a live SharePoint 2013 extranet site that is actively used by staff as well as external clients. Since the update caused our extranet site to be unavailable for several hours, I found myself wishing for a simple but effective way to alert all SharePoint 2013 site users about upcoming scheduled maintenance. I could send e-mails, but prefer not to do so since we have quite a few people who have access to the SharePoint site, but very few active users. Instead of sending out alerts to more than one hundred employees letting them know that a service they may or may not use will be unavailable, I wanted to publish a notice to the SharePoint site itself.
I need to find a way to publish a notice of anticipated service interruptions on every page of my SharePoint 2013 site. This seemed simple enough at first, until I began to consider the fact that I have multiple site collections, each with multiple sites in my extranet Web Application. Users access the site from a wide variety of links, so publishing a notice on the home page would not be effective. Every site has unique permissions, depending on which users need access to the site’s contents, so publishing announcements on a site-by-site basis would be a real chore.
I am using a pretty generic out-of-the-box SharePoint 2013 installation, so my site is using the default Seattle master pages. I thought about customizing the master pages to include a message, but I would have to do the same for every site collection in my Web Application, which seems to be more trouble than it’s probably worth.
A few weeks ago, I ran across this blog post from “Chris on SharePoint” explaining how to change the out-of-the-box “SharePoint” text in the upper left-hand corner of every page in a SharePoint 2013 site into whatever text or image you want to display. This area of the page is known as the Suite Bar, and the left-hand text is the Branding Element of the Suite Bar. When I followed the instructions from the Chris on SharePoint blog, I was able to change the Suite Bar Branding Element for every site and site collection within my Web Application quite easily.
So, as I was thinking about how to notify the few active users about upcoming site maintenance on my SharePoint 2013 site, I thought that this Suite Bar might be just the right place to put in a small notice or warning letting users know about something coming up. I decided to write a PowerShell script that would automatically create the Suite Bar Branding Element HTML for me with just a few variables. This way, I can easily restore the default HTML by just skipping over the variables. But if I want to throw a special notice for users into the Suite Bar, I can just run the script, fill out a few prompts, and, presto, I have a new Suite Bar with a notice visible to all users about upcoming maintenance schedules!
Notes: This script, when run, will prompt the user to enter the URL of a SharePoint 2013 Web Application and will build the Suite Bar Branding Element HTML to provide both the desired branding element as well as important warnings or notices provided by the user (If any).
Running the Script:
Copy the code above and paste it into a new plain text document (i.e. Notepad) on any of the SharePoint 2013 servers in your farm. Next, open the SharePoint 2013 Management Shell application as an administrator (Right-click on the app name to get the “Run as Administrator” option to appear):
If you have UAC enabled, you’ll have to confirm you want to run this program with administrative privileges:
From the SharePoint 2013 Management Shell console, navigate to the directory where your new .ps1 file is stored:
Run the script by typing “.\Add_Notice_To_SuiteBar.ps1” (Obviously, change this to whatever filename you gave your script. Just don’t forget the “.\” before the filename):
You will be prompted to enter the URL of the Top Level Site Collection in your Web Application:
Press enter and follow the on-screen prompts to enter the values for any notices you may have:
There are five optional variables that can be configured using this script:
- Enter a one-word type for this notice:
This is the first word of your notice, and will indicate to the visitor the severity of the information you are providing. Examples are “Warning,” “Note,” “Notice,” “Alert,” “Caution,” etc.
In this example: “Notice”
- Enter a Hexadecimal color for this Notice:
Enter the full hexadecimal color code for the background color of your notice (blank for the default background).
In this example: “#FFFF00”
- Enter a Hexadecimal Font Color for this Notice:
Enter the full hexadecimal color code for the font color of your notice (blank for default font color).
In this example: “#FF0000”
- Describe in a few words:
Tell users an abbreviated version of your message. Remember that the Suite Bar is not too big, so just give a few words like “Site maintenance this Thursday” or something else brief but descriptive.
In this example: “Routine Maintenance scheduled for October 12”
- Enter a URL where users can read more information:
Provide the full URL of a website that has more information about this notice.
In this example: “http://sharepointserver/Public/10-12-Maintenance.aspx
Once the script has run, you’ll see your Suite Bar Branding Element look like this on every page in your SharePoint 2013 Web Application:
That’s all for today…now get out there and Write the Web!