SharePoint 2010 | Information Architecture Diagram Using PowerShell and Visio

As SharePoint consultants, we don’t always have the luxury of building our farms and the site structures from the ground up.  Sometimes we walk into a situation where the farm and sites have already been up for several years.  However, having a well-planned Information Architecture is critical for any successful SharePoint implementation.  As SharePoint gains in popularity and use, sites are created as one-offs, and after a while our environments start to run wild.  Sites are created without our knowledge or placed as sub-sites of other sites where they don’t really belong.  The power of SharePoint to make web technology accessible to the average information worker is also one of the biggest elephants in the room when it comes to proper and successful implementations.

At some point, whether you are designing the information architecture for the first time or you are going through a regular audit and review of your site structures, you’ll need to get the big picture.  What sites are where?  How do you start the conversation with management that site sprawl is affecting the usability of the system?  When dealing with management, the one thing I’ve learned is that they don’t want to see code or lengthy documents.  If you can’t get your point across in 2 minutes they’ll tune out.  So you have to start the conversation with a visual tool.  A graphical representation of the sites and subsites in a web application would be the perfect tool to give the 50,000 foot view of your sites.  Unfortunately we don’t get that out of the box with SharePoint.  However, this sort of diagram is easy to create with a little bit of PowerShell know how and some Visio diagramming wizards.

We’re looking to create a Visio diagram that makes it easy to visualize site and subsite structures.  The diagram should have relevant and important data about each site.  The layout should show how wide or deep our web application goes and allow us to find the sites that are buried deep inside out information architecture that should be brought up closer to the root.  If our information architecture is too wide we should be able to identify sites that can be pruned or moved under other sites in order to properly categorize them and make them more visible to the end user.

Gather SharePoint Data With PowerShell

Nobody would want to create this diagram by hand.  First off, imagine how long it would take if you had hundreds of sites.  Second, unless you have extremely tight governance controls already in place, the document would be outdated even before it was finished.The fist step is that we need to create a method of extracting the site hierarchy from the SharePoint farm that is easy and repeatable.  This is where PowerShell is a huge help for us.

  1. Remote to one of your SharePoint farm servers and open PowerShell
  2. Run the following PS command:
Get-SPWebApplication http://sharepoint| Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID | Export-CSV C:\InfoArch.csv -NoTypeInformation

And what we get now is a nice set of records showing the following properties for each SPweb:

We could also choose to select additional properties of the SPWeb, it really depends on what other information you want to have available to you in the final Visio diagram.

Convert the CSV in Excel

Once we’ve created the CSV file with the elements we need for our Visio diagram, we need to go in and tweak a few things so that the final product formats correctly and shows a nice high level architecture.  In this case, we may find that there will be certain site collections with a ParentWebID GUID of “00000000-0000-0000-0000-000000000000″.  For our purposes, only the actual root of the web application should have this.  All the other site collections should be linked to the root by replacing their ParentWebID with the ID from the root site collection.  In order to do this:

1. Open the CSV file in Excel (Note: You’ll probably copy the CSV to your desktop, because MS Office should not be running on a SharePoint server)

image

2. To link all of the Site Collections to the root Site Collection, replace all ParentWebID’s that are “00000000-0000-0000-0000-000000000000″ (minus the Root’s) with the ID from the root Site Collection. So, in our example, all of the sites after the first record with a ParentWebID of “00000000-0000-0000-0000-000000000000″ would be replaced by the ID of the Root Site Collection “5b8bbd9b-1cb4-4c8f-a624-b464d08cd32c″ (except as noted where the first record is concerned).

image

3. Now that we have our data structured properly, save the file as XLSX so Visio can properly consume it as a data source.

image

Use Visio to Create the Information Architecture Diagram

1. Launch Visio 2010, and under the New selection, under the template categories you’ll want Business.  Select the Organization Chart Wizard

Visio 2010

Visio 2013 (Updated)

clip_image005 image

 

2. The wizard will start, choose ”Information that’s already stored in a file or database” and click Next

image

(I would update to show Visio 2013, but hey, they are the same dialog boxes!)

3. Choose “A text, Org Plus (*.txt) or Excel file, click Next.

image

4. Browse to where you saved the XLSX file and click Next.

image

5. Here is where the magic happens, instead of using the Employee/Manager relationships, we use ID for the Name, and ParentWebId for the Reports To fields.

image

6. This screen will be different, depending on what properties of the SPWeb you selected in your PowerShell script.  To keep it simple, I’ll just use the Title so that it will be the only label displayed on the diagram.

image

7. For shape data fields, it generally makes sense to leave all the columns in there.  This allows the Visio drill-down to be able to display all the relevant data about the SPWeb that you selected in your PowerShell scripts.  So for instance, if I had included the site owner property in my properties select, I would be able to click on a website shape and see who the site owner of the web was.

image

EDIT for Visio 2013: Don’t include pictures in my organization chart.

image

8. Select “I want to specify how much of my organization to display on each page” and click Next

image

9. For now, just keep the one page with your root Site Collection as the Employee at Top of Page and click Finish.

image

Once the Visio Organizational Chart Wizard completes its processing, you should have a single page diagram with the root Site Collection at the top of the page, and all the various sites and subsites under it (just like an org chart!).  Depending on how big your site is and your own computer processing power, this may take a few minutes to finish, so grab a cup of coffee and congratulate yourself on creating a great visual tool of your Information Architecture.

Explore the Visio Diagram of Your SharePoint Information Architecture

Once the process completes, you should have a single page Visio diagram with the Root at the top and Site Collections and subsites connected underneath.

EDIT: Visio 2013 diagram

image

 

Of course, when you select a particular site’s shape data, you can see all the additional information we chose to include from the SPWeb.

imageimage

NOTE: Article edited to update to Visio 2013.

19 thoughts on “SharePoint 2010 | Information Architecture Diagram Using PowerShell and Visio”

  1. Great stuff!
    Did not know that Visio could do that at all.
    Tried it now at our site, worked like a charm.

    Elegant solution, thank you for sharing.

    1. Glad it helped! I’ve found that visually laying out a site hierarchy can be very revealing as to how one has set up their information architecture by showing how wide and deep it goes. Also helps when you’re trying to do a site re-org to recognize patterns and natural groupings.

  2. Thanks for the post. Love the Visio diagram. Manager loves it too when I tried to explain to him why we needed some governance on SharePoint.

  3. Really good. however, the sort is all messed up. For example. I have legal first in the child tree as opposed to accounting. after legal i have marketing then corporate then sales. How do I go fixing this?

  4. Amber, if the sort is important, you can sort the rows by the Title field before you save the data as an XLSX file. Then when Viso renders the information architecture in the diagram it basically creates the strucuture by reading each line sequentially, and thus will build out the strucutre in alphabetical order from left to right and top to bottom. I just tested this in Visio 2013 and it works, pretty sure 2010 will behave the same way.

  5. Great solution, works perfectly, thank you! One question – you say ‘if I had included the site owner property in my properties select, I would be able to click on a website shape and see who the site owner of the web was.’ – what is the actual name of the site owner property?

    1. Dave,

      It’s going to depend on how you’ve set up the sites and site collections in your heirarchy as to what fields will be meaningful, but the the item you’re probably looking for would be either the AssociatedOwnerGroup ( http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.spweb.associatedownergroup(v=office.14).aspx ) or SiteAdministrators property ( http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.spweb.siteadministrators(v=office.14).aspx )

      The AssociatedOwnersGroup property will work as you would expect, giving you the group name associated with each web

      SiteAdministrators are the Site Collection Admins; However, if you add tha property directly to the select statement, all you’ll get as an output is a bunch of cells with “Microsoft.SharePoint.SPUserCollection”

      Instead you need to use PowerShell expressions to expand the list: @{Name=’SiteAdministrators’;Expression={[string]::join(“;”, ($_.SiteAdministrators))}}

      So the complete powershell command to get the Owners Group and the Site Collection Admins would look like the following:

      Get-SPWebApplication http://sharepoint| Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID, AssociatedOwnerGroup, @{Name=’SiteAdministrators’;Expression={[string]::join(“;”, ($_.SiteAdministrators))}} | Export-CSV C:\InfoArch.csv -NoTypeInformation

  6. Great Solution works! It displays all sites.
    Could you amend the script to show all Pages
    for each site? Not sure how to do that.

  7. Was recently introduced to this link via classmate in a SP2013 training course. Absolutely genius in it’s usefulness. Thank you for sharing with us!

Leave a Reply