Sunday, March 4, 2012

SharePoint SubSite Size Storage Report

SharePoint 2010 offers nice storage reports with sub-sites. Go to: Site actions > Site Collection Administration >  Storage Metrics to determine size of SharePoint 2010 subsite

sharepoint 2010 subsite size

For MOSS 2007,  There is no out of the box storage report to find SharePoint subsite size. But found this nifty utility, SharePoint Space Monitor:
get sharepoint subsite size

Free Registration is required. Get it from here: http://scmodsoft.com/product/sharepoint-space-monitor/

Get SharePoint Subsite Size with PowerShell: how to check SharePoint subsite size? We Can use PowerShell to get subsite size. Here is the PowerShell script to get SharePoint subsite size: (works in both SharePoint 2007 and SharePoint 2010)
#Get Size of all Sub-sites in a Site Collection
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

# Function to calculate folder size
Function CalculateFolderSize($Folder)
{
    [long]$FolderSize = 0
 
    foreach ($File in $Folder.Files)
    {
   #Get File Size
        $FolderSize += $file.TotalLength;
   
  #Get the Versions Size
        foreach ($FileVersion in $File.Versions)
        {
            $FolderSize += $FileVersion.Size
        }
    }
 #Iterate through all subfolders
    foreach ($SubFolder in $Folder.SubFolders)
    {
  #Call the function recursively
        $FolderSize += CalculateFolderSize $SubFolder
    }
    return $FolderSize
}

 
$SiteURL = "http://sharepoint.company.com/"
$Site = new-object Microsoft.SharePoint.SPSite($SiteURL)
 
  foreach($Web in $Site.AllWebs)
  { 
    #Call function to calculate Folder Size
    [long]$WebSize = CalculateFolderSize($Web.RootFolder)
   
    #Get Recycle Bin Size
    foreach($RecycleBinItem in $Web.RecycleBin)
        {
           $WebSize += $RecycleBinItem.Size
        }
 
        $Size = [Math]::Round($WebSize/1MB, 2)
        Write-Host  $web.Url ":`t" $Size "MB"

    #Dispose the object
    $web.dispose()
   }
 
Site Storage Analysis: Don't want to use Tools/Scripts? just Map your site collection to a Network drive, Use Disk space analyzing tool (jDiskReport, WinDirStat are good choices) to get insights on which site/library eating space!



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

2 comments :

  1. I would like to make this script formatted and email it to my SharePoint team. Can you help code this for me since I have no development experience?

    ReplyDelete
  2. $Size = [Math]::Round($WebSize/1MB, 2)
    Write-Host $web.Url ":`t" $Size "MB" ":`t" $web.LastItemModifiedDate
    $s = $web.Url +": "+ $Size +"MB " +" #" + $web.LastItemModifiedDate
    write-output $s >>get-site-space.txt

    ReplyDelete

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...