SharePoint Information Architecture Diagram Using PowerShell and Visio

Having a well-planned Information Architecture is critical for the success of a SharePoint implementation. Sometimes, as we all know, our environments get away from us and site owners start running frantic – sites are created without our knowledge or placed where they shouldn’t. You have had enough and it’s time for reorganization (and perhaps a new security model) – but how do you know what you have now in order to thoroughly plan things out? Technology to the rescue! Let’s use the “power” of PowerShell and Visio to do this for us.

What we will have at the end – a nice Visio Information Architecture diagram to help us with a site reorg!

Now, how we got there:

On the SharePoint server, open the SharePoint 2010 Management Shell and perform the following command:

Get-SPWebApplication https://portal.contoso.com | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID | Export-CSV C:\InfoArch.csv -NoTypeInformation

Open the CSV file in Excel.

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 “00000000-0000-0000-0000-000000000000″ values would be replaced by the ID of the Root Site Collection “0c187a2c-e3fa-42e8-9de6-6b2987e41972″.

Save the file as XLSX, then open Visio 2010

On the New selection, pick Business under Template Categories and then Organization Chart Wizard

The wizard will start, accept the default of” Information that is stored on a file…” and click Next

Click Next again to say that the data is stored in an Excel file

Browse for the saved XLSX file and click Next

This screen is the most important; this is where you tell the wizard what the Employee-Manager relationship is. For our case, Name is the ID of the site and Reports To is the ParentWebID.

On this screen, we tell Visio which fields we want to display on each box. To keep it clean, I just pick the Title.

For Shape Data, you should pick all of the columns. This way you can select each box and display the data relevant to that site. For instance, we could have included the Site Owner, Last Modified Date, or Created date in our PowerShell command and included those columns in the Shape Data as well.

Leave the default of “I want to specify how much…” and click Next

Leave the default again and click Finish

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. I applied a green theme to help showcase the chart more.

Zoomed in view of a Site Collection named IT with subsites Helpdesk, Apps, and Forms

Zoomed in view of shape data after clicking on the Helpdesk subsite

I know what you are thinking – you can save this as a Visio Web Drawing file, publish it to SharePoint 2010 using the Visio Graphics Service and have users click on each site to see Owners, Created Date, Web Template, and more! Yes, I am a mind reader; now go for it!

avatar

About Adam Preston

Adam is a Senior Consultant specializing in the administration and configuration of SharePoint. He holds several SharePoint certifications, including MCITP: SharePoint Administrator 2010. He is the Vice President of the Richmond SharePoint Users Group and active throughout the SharePoint community via Twitter (@_apreston) and MSDN Forums.
This entry was posted in Administration, PowerShell and tagged , , , . Bookmark the permalink.

18 Responses to SharePoint Information Architecture Diagram Using PowerShell and Visio

  1. Very nice! Although the key to a decent information architecture is to plan it properly *before* you start building anything in SharePoint. If you use PowerShell to build the hierarchy of SP sites, the inherent structure of that code file is also the documentation. Albeit not in such a pretty form.

    As a way to generate an overview of your sites, in order to find out where everything’s gone wrong, this Visio method is really neat though.

    • avatar Adam Preston says:

      Completely agree, good IA is done BEFORE you implement SharePoint. I was just playing off of the cases where this did not occur or you upgraded and didn’t do a reorg at the same time. Thanks for the kind words and taking your time out to read our post!

  2. avatar Dov Trietsch says:

    Very nice indeed! As a consultant, I frequently need to do an ‘inventory’ on a clients existing resources and this is just what the doctor has ordered.

    Dov

  3. avatar Dov Trietsch says:

    Very nice and useful. As a consultant, I frequently need to do an ‘inventory’ of the client’s resources and this is exactly what the doctor ordered.

    Dov

  4. Pingback: SharePoint Information Architecture Diagram Using PowerShell and Visio « SP2010 Blog

  5. avatar Darren Hemming says:

    Excellent blending of tools – very creative and definitely useful. I was wondering if we could automate the ID rename as part of the script. What if we write all the SPWebs into an array, then iterate through that doing a ‘replace’? Then the whole array gets output to CSV as usual.

    I’m no Visio expert, but are there then macros that we can use to automate the rest?

  6. Pingback: Take a Gander at PowerShell to Generate a SharePoint Architecture Diagram : Beyond Search

  7. avatar Ravi says:

    Hi Adam,

    Great presentation at SPS VB. Could you post how this can work in a MOSS 2007 environment.

    Thank, I’m also looking forward to all of your cool scripts that you presented yesterday.

    -Ravi Mathaudhu

    • avatar Adam Preston says:

      Thanks for the kind words and attending! It was a great event! I will be posting the slides and scripts soon. To do this for 2007, you just need to get the Site Collection object and then pipe each subsite and output the ID and ParentID:

      $webs = @($sites.AllWebs | select-object Url,Name,Title,LastItemModifiedDate,Created,ParentWebID,ID | sort Url )

  8. avatar Matt says:

    This was perfect timing for me. I’m engaged in trying to break down sites due to large content databases. I needed some way to find out how sites were being used and what the structure looked like. Using the below script and Visio Data Graphics I can get a coniditional formating of the objects using the “Last Update” field. So anything 0-90 would be green, 91-180 yellow, 181+ red. That gives me an overall view of site usage. Very handy when you need to break things up or archive sites that haven’t been used for years.

    I should note though that when I’m working on a particular section I use a filter in the code. I have to edit that manually. Also it’s code from a different sctipt so I haven’t updated the comments yet. :/
    Hope this helps someone.

    #
    # ————————————————————————
    # NAME: Get-SiteInventory.ps1
    # AUTHOR:
    # DATE:
    #
    # KEYWORDS: Sharepoint, Inventory, 2007, 2010
    #
    # COMMENTS: This script will be used to get a list of lists and counts for
    # a site url. It will traverse the URL and go though the subsites
    # as well.
    #
    # ————————————————————————
    #
    Function Get-WebSiteInventory{

    #
    Param([string]$siteUrl
    )
    Try{
    [void][System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
    }
    Catch [System.Management.Automation.MethodInvocationException]
    {
    Return “Error loading Sharepoint assembly: ” + $Error[0].Exception.Message
    }
    Catch
    {
    Return “Some other strange and creepy Sharepoint error: ” + $Error[0].Exception.Message
    }
    Try{
    $site = New-Object Microsoft.SharePoint.SPSite($siteUrl)
    }
    Catch [System.Management.Automation.MethodInvocationException]
    {
    Return “Error loading Sharepoint assembly: ” + $Error[0].Exception.Message
    }
    Catch
    {
    Return “Some other strange and creepy Sharepoint error: ” + $Error[0].Exception.Message
    }

    foreach ($web in $site.AllWebs) {
    if ($web.url -like “http://SharepointSite/SubSite/Subsite*”){
    $LastModified = $Web.LastItemModifiedDate
    $SnapShot = (get-date)
    $LastUpdate = ($SnapShot – [datetime]$LastModified)
    $data = @{
    “Site” = $web.title
    “URL” = $web.url
    “ID” = $web.ID
    “ParentID” = $web.ParentWebID
    “Last Modified” = $web.LastItemModifiedDate
    “Snaphost Date” = $SnapShot
    “Last Update” = $LastUpdate.Days
    }
    New-Object PSObject -Property $data

    }
    $web.Dispose();
    }
    $site.Dispose()
    }

    Get-WebSiteInventory “http://Site/” | Export-Csv -NoTypeInformation -Path c:\temp\SiteWebInventory.csv

  9. avatar Matt says:

    I forgot to add if you modify the script and use http://site* as the filter (which would be the root site) then you don’t need to edit the file to replace “0000-…” entries. I use this script on Sharepoint 2007, but I think it should work on 2010 as well. Also, no need to open the file in Excel first. Visio can read the CSV file just fine.

  10. avatar Tim Newis says:

    Thanks for the initial post Adam and some great follw-up.

    This is definitley one that I’ll be saving but to pick up on one of the replies regarding pre-build IA and logical architecture design. I use the CodePlex solution AutoSPInstaller (http://autospinstaller.codeplex.com/) and have long since felt that there must be a way to port from a visual representation created in Visio into the AutoSPInstallerInput.xml congiuration file to provide more digestable documentation for farm deployments and application build.
    Any offers…?

    • avatar Adam Preston says:

      Ah, I like where you are going with this – reverse the process and use the Visio diagram to create the Site Collections and Subsites. I may have to look into this. That would be very useful!

      • avatar Matt says:

        Yes I think that would work. I currently use a CSV file and Powershell to populate a lower environment. Basically I get the URL from the prod site and save it to a CSV file with relative url, title, and template. I then use the addweb method to create the sub webs but piping in the CSV file. That gives me a site that’s stubbed out like production but with no data.

        Yeah, I think that would work as long as you can get to the Visio objects.

  11. Pingback: Automate your SharePoint 2010 Site Collections Inventory with Visio | Benjamin Niaulin

  12. Pingback: SharePoint Information Architecture Diagram Using PowerShell and Visio « SharePoint Shenanigans

  13. Pingback: SharePoint Information Architecture Diagram Using PowerShell and Visio « SharePoint Adam

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>