How to calculate total size of a Document library using Powershell in SharePoint 2013/2010/2016?`

Hello SharePointers,

Below are the script to find the actual size of documents in document library using Powershell.

foreach ($web in $site.AllWebs)
{
$DocLibSize=0
$count=0
foreach ($list in $web.Lists)
{

if($list.BaseTemplate -eq “DocumentLibrary”)
{
$itemSize = 0
foreach ($item in $list.items)
{
$itemSize += ($item.file).length
}
$itemSize= [Math]::Round(($itemSize/1MB),2)
Write-Host $itemSize “MB ”
$DocLibSize+=$itemSize
}
}
Write-Host Size :” “($DocLibSize/1024) “GB”
Write-Host $count

Happy SharePointing Folks 🙂

Leave a Reply

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