One feature that many people ask for in Moss is a way to generate a list of all existing sites in a Site Collection. This especially useful when you want to make an inventory before a migration or just to get a good view of how many sites you actually have. What you have out of the box is the Site Hierarchy and the Site Content and Structure both found in the Site Settings at the root site.

The Site Hierarchy simply shows a list of all sites in the Site Collection with URL, Title and a link to their respectively Site Settings page.

sitehierarchy

From this page you could do a copy and paste in to Excel and then from there do whatever you want do with the information; count the sites, or use it as a base for your inventory.

The other option, the Site Content and Structure page gives you a little bit more information like, last modified and who has created the site but on the other hand, you will not be able to generate any report and there is no good way to copy the information and past to Excel.

sitecontentandstructuer

There are a couple of 3de party products out there that could help you with generating such a report and in addition you often get other various statistics such as size, created date, owner etc.

But there are other ways to do this that is more customizable and best of all, it’s free! It is possible with PowerShell to loop through all sites in a Site Collection and then easy export it to a CSV file to open up in Excel. In this script we will extract the following information:

Name
Title
Description
Theme
WebTemplate
Author
Created
Modified
Sites
Users
ParentWeb
Url
ServerRelativeUrl
ID

But more information is available and it should also be mentioned that the loop is useful in many other scenarios were you want to perform the same task on all your sites. For instance you could use it in our previous post where we removed old users from a site (found here). So, let’s take a look at the script and get an explanation of how it’s done and what it does. Read part 2 at www.powershell.nu

If you want to download the script you find it on the downloads section