Last active
June 12, 2018 15:11
-
-
Save vaderj/23c6ce0f0dad4e70b1b58f825a8a86a5 to your computer and use it in GitHub Desktop.
Powershell - Get size of SharePoint document libray #PowerShell #SharePoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-PSSnapin Microsoft.SharePoint.PowerShell | |
$siteURL = "YourSitename" | |
$site = new-object Microsoft.SharePoint.SPSite($siteURL) | |
foreach ($web in $site.AllWebs) | |
{ | |
foreach ($list in $web.Lists) | |
{ | |
if($list.BaseType -eq "DocumentLibrary") | |
{ | |
$listSize = 0 | |
foreach ($item in $list.items) | |
{ | |
$listSize += ($item.file).length | |
} | |
"Web Name: "+$web.Title+", Library Name: "+$list.Title+", Size: "+[Math]::Round(($listSize/1KB),2)+"KB" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment