How do I determine the database and subsite size of my 2007 SPS environnment? I do have access to central administration


As we know SharePoint content database works based on site collection not sub site. So, in order to get database size report for a sub site we need to write custom coding... there is no inbuilt PS command or stsadm command to handle this.

We can use the below open source solution for this requirement, it is very simple and easy to use free tool :


Reference URL :

How to find the SubSite size of SharePoint site 2007

Similarly, we can use the below PowerShell script :

#Get Size of all Sub-sites in a Site Collection



# 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



Reference URL: https://www.sharepointdiary.com/2012/03/sharepoint-sub-site-storage-report.html#ixzz6CBs65rGH


the method to find out the size of a single site collection in a content database that can potentially hold multiple site collections is by using the stsadm -o enumsites command on one of the SharePoint servers.


Web application url = http://portal.contoso.com

connect to SharePoint server start command prompt ( Start - Run - cmd.exe ) navigate to the 12-hive cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin stsadm -o enumsites -url http://portal.contoso.com > enumsites.txt notepad enumsites.txt This will give you a XML file with an overview of all site collections of your web application, including the database they are located in an the size of the site collection and looks like this:

<Sites Count="4">
  <Site Url="http://portal.contoso.com" Owner="CONTOSO\bill" ContentDatabase="WSS_Content_Portal" StorageUsedMB="2122.2" StorageWarningMB="0" StorageMaxMB="0" />
  <Site Url="http://portal.contoso.com/sites/siteA" Owner="CONTOSO\bill" ContentDatabase="WSS_Content_Portal" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
  <Site Url="http://portal.contoso.com/sites/siteB" Owner="CONTOSO\bill" ContentDatabase="WSS_Content_Portal" StorageUsedMB="100.2" StorageWarningMB="0" StorageMaxMB="0" />
  <Site Url="http://portal.contoso.com/sites/siteC" Owner="CONTOSO\bill" ContentDatabase="WSS_Content_Portal" StorageUsedMB="0.4" StorageWarningMB="0" StorageMaxMB="0" />

If you only want to report on a single database in the web application add the -databasename parameter:

stsadm -o enumsites -url http://portal.contoso.com -databasename WSS_Content_Portal > enumsites.txt



Using powershell and code, refer


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.