Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am doing capacity planning for a new SharePoint 2010 site, and it would be useful to know the average file size on an existing SharePoint 2007 Server we have for comparision.

Does anyone know if there is a way to query this?

Added bonus would be querying the average number of files per user.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

This could take quite a long time to run, but here's the straight forward method:

$count = 0L
$totalSize = 0L
$WebApplications = Get-SPWebApplication
foreach ($webApp in $WebApplications){
  foreach ($site in $webApp.Sites){
    foreach ($web in $site.AllWebs){
      foreach ($list in $web.Lists){
        if ($list.BaseType -eq "DocumentLibrary"){
          foreach ($item in $list.Items){
            $totalSize += $item.File.Length
            $count++
          }
        }
      }
      $web.Dispose()
    }
    $site.Dispose()
  }
}
Write-Host "Average file size: $($totalSize/$count)"
share|improve this answer
    
Great, Thanks! It is just a one off sizing exercise, so speed doesn't really matter. –  Andrew May 11 '11 at 1:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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