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 the size of SharePoint subsite

sharepoint 2010 subsite size

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 = "https://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!

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “SharePoint SubSite Size Storage Report

  • $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

    Reply
  • 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?

    Reply

Leave a Reply

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