I have a really large SharePoint 2007 environment with lots of site collections and each site collection has a number of subsites. I would like to monitor whether these subsites are used. I know there are many reporting tools but I don't want to look at a report manually. I would like to receive an e-mail alert (for example) once a week which shows me the unused subsites so I can contact the owners of these sites. Are there any third party tools that can do this for me? If not, is there a way to implement this with code without using timer jobs?


You would need either a C# application or a PowerShell script that would run as a scheduled task. The important thing is how to access each SPWeb in the site collection. I don't know enough about your requirements or your environment to make a guess about this. You might want to do it recursively for every site and sub-site in each site collection (something that could really slow down a server) or you might not. I'll leave that up to you. Don't forget to dispose of your web objects!

The code in PowerShell would look something like this:

$site = new-object Microsoft.SharePoint.SPSite("http://sharepoint.domain.com/")

foreach($web in $site.RootWeb.Webs)
    if($web.LastItemModifiedDate -lt (Get-Date).AddDays(-30))
        #Do stuff here to send your email


| improve this answer | |
  • 1
    May want to add a throttle like "Start-Sleep -s 1" inside the foreach loop... ;) – Matthew McDermott Mar 25 '14 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.