SharePoint 2010: Create a Pretty Table of Farm Services

Once you’ve built a SharePoint 2010 Farm, you usually need to document it. Part of the documentation should be a list of what services are running on which server. Most folks will probably either screen shot the Central Admin page showing the services running on a server, but that only shows one server at a time, so you need a screen shot for each server, and these can be tough to read.

Or you might use a PowerShell script to list the services running on each server, which is somewhat better, but still tricky to read critically.

Wouldn’t you rather have a chart like this in your documentation?

SharePoint Services Chart in Excel


Well follow along and find out how!

Listing the Services

First we’ll get the list of services by server. Start the SharePoint 2010 Management Shell (Start –> All Programs –> Microsoft SharePoint 2010 Products ). The PowerShell command to list running services by server is as follows:

Get-SPServer |
Foreach-Object {
    $_.ServicesInstances |
        $_.Status -eq "Online"
} |
Select TypeName, Parent |
Export-csv c:\path\Services_List_$env:computername.csv

This will produce a list like this:

#TYPE Selected.Microsoft.SharePoint.Administration.SPDatabaseServiceInstance
"SharePoint Foundation Search","SPServer Name=MyFarmServer01"
"Information Management Policy Configuration Service","SPServer Name=MyFarmServer01"
"SharePoint Server Search","SPServer Name=MyFarmServer01"
"Managed Metadata Web Service","SPServer Name=MyFarmServer01"
"Microsoft SharePoint Foundation Usage","SPServer Name=MyFarmServer01"
"Business Data Connectivity Service","SPServer Name=MyFarmServer01"
"Secure Store Service","SPServer Name=MyFarmServer01"

…as a csv file. If you open it in Excel, you’ll have a sheet which looks like this:

Services In Excel


Uh, okay – now what? Now it’s Excel magic time!

First we can open out the columns to see all our info:

Columns Opened


Of course the server names look icky (technical term), so we run a quick find/replace – select the column, then click the “Find & Select” button in the ribbon. Search for “SPServer Name=” and replace it with nothing, then do a Replace All:

Find and Replace


This should give you something that looks like this:

Fixed Server Names

(Note: You may also have the mail server and database servers listed. I had already deleted them from this list, since they don’t add much. It’s up to you whether to leave them or not)

You will need to delete the first line (#TYPE Selected.Microsoft.SharePoint.Administration…)

Now you can either click & drag to select all the rows, or just click any cell in your list. Then click “Format as Table” and select a table format (I’m partial to blue with alternating rows). You’ll get a little dialog with the range selected (it will have automatically selected the full range). Check “My table has headers” then click “OK” You should get a formatted table as shown:

Formatted Table


Click on “TypeName” and type “Services,” then replace “Parent” with “Servers.” Now click in C1, the column next to Servers, and type “Count” – once you leave the cell, Excel should expand the table to include the new column:

Added Count

Click in C2 and type a “1” then the enter key. Then click back in the C2 cell, then click the little “handle” in the lower right of the cell highlight and drag it down the length of the table:

Click Handle


This should fill the column with number 1’s – you’ll see why in a moment.

Now click the Table Tools / Design tab on the ribbon, and click the “Summarize with PivotTable” button. Keep the defaults – the selected table and to insert the table in a new spreadsheet, then click OK. This will open the PivotTable editor in a new sheet:

PivotTable Editor

In the field list on the right you should see “Services,” “Servers,” and “Count.” Drag “Services” down to where it says “Row Labels.” Then drag “Servers” to “Column Labels” and “Count” to “Values”:

Pivot Table Fields


Your pivot table should now look like this:

Pivot Table


You can type over “Row Labels,” “Column Labels” and “Sum of Count” to more intelligent names like “Services,” “Servers,” and the Farm Name. Let’s also get rid of those Totals – right-click anywhere in the Pivot Table and select “PivotTable Options” to open the options dialog. Select the “Totals & Filters” tab, then uncheck “Show grand totals for rows” and “Show grand totals for columns”:

Removing Totals

Click “OK”.

Finally, click on any of the “1” values, then on the Home tab in the Ribbon click “Conditional Formatting” then “Icon Sets” and the icon set with the check, exclamation, and red “X.” This will format the single cell, but you’ll see a small icon next to it – click on it:

Selecting Pivot Table values

From the menu, select “All cells showing ‘MyFarm’ values” – this should cover the whole range with the symbols you selected:

All Selected Symbols

One step left – let’s get rid of those ones digits! Click on the “Conditional Formatting” button and select “Manage Rules.” In the Conditional Formatting Rules Manager, select your rule, then click the “Edit Rule” button. In the “Edit Formatting Rule” dialog, check “Show Icon Only.” Then click “OK” and “OK” again. Select all the check marks, click the formatting button to center them, and voila!

Final Table

I’m working on macros to make this easier, and after that comes an Add-In to copy the table to an editable range and export it to XML, and finally a PowerShell script to take that XML script and use it to flip services on and off… Hopefully…