Using #PowerShell to get #SharePoint site structure as CSV data

By | March 6, 2013

I’m always looking at customer site structure in SharePoint and wanted a faster way to map this out using a mind mapping tool or Excel.

Good news is that this is pretty easy if you combine a bit of PowerShell and good old CSV.

Getting the data out of SharePoint is pretty simple:

Option 1 – specific web application

Get-SpWebApplication <insert web app URL here> | Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID | Export-CSV “<insert csv file path and name here>” -NoTypeInformation

Option 2 – all web applications

$allwebapps = Get-SPWebApplication | select url
foreach ($webapp in $allwebapps) {
Get-SPSite -Limit All | Get-SPWeb -Limit All | Select Title, URL, ID, ParentWebID | Export-CSV “<insert csv file path and name here>” -NoTypeInformation
}

Once you have the CSV file you can pull it into your tool of choice (I like MindJet and Excel) but you have to remember 1 thing – when you look at the CSV file you will notice a bunch of your sites may have a parent ID of 00000000-0000-0000-0000-000000000000. Apart from the root site collections, this is not corrrect – you will need to re-parent the sites to the correct root site parent ID – this is pretty simple find and replace in Excel. I’m not going to insult your intelligence by proposing how you should do this 🙂

I may, one day come up with a cunning PowerShell script that does this, but not today.

more to follow…

3 thoughts on “Using #PowerShell to get #SharePoint site structure as CSV data

  1. Scott

    I was going to see if I could get the farm admins to run this for me, but then I noticed that it was for a single web app or all web apps. Sadly, the people who designed this farm’s architecture decided to make it multi-tenant with EVERYONE using the same web app. Sadness reigns.

    Reply
  2. Pingback: Inventory SharePoint 2010 with Site Title, URL, ID, ParentWebId, & Size | DL-UAT

  3. Pingback: Inventory SharePoint 2010 with Site Title, URL, ID, ParentWebId, & Size | Question and Answer

Leave a Reply

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