2

How can I check what is the size of a single site? exp. domain/name.of.site

This site is on root site collection. I know how to get site collection size, but I want size of only particular site.

I tried this command:

Get-SPSite http://sps2013 | Select Url, @{Label="Size";Expression={$_.usage.Storage/1MB}}

But it is not working.
Any help or suggestion?

  • 2
    use get-spweb for a specific site/subsite versus get-spsite for the site collection – Eric Alexander Nov 23 '16 at 15:18
  • giving me 0 as a result. I uploaded a week ago at least 50-100MB. – Danilo Nov 23 '16 at 15:30
  • 1
    I also tried this with 0 result ! and the above command work only for site collection – Mohamed El-Qassas MVP Nov 23 '16 at 15:39
1

Solved it. In Site Settings > Site Collection Administration > Storage Metrics, sites of site collection are shown in list. I found site that I was looking for and its size.

0

There is no simple powershell for this purpose, you can try the below script.

 function GetWebSizes ($StartWeb)
{
    $web = Get-SPWeb $StartWeb
    [long]$total = 0
    $total += GetWebSize -Web $web
    $total += GetSubWebSizes -Web $web
    $totalInMb = ($total/1024)/1024
    $totalInMb = "{0:N2}" -f $totalInMb
    $totalInGb = (($total/1024)/1024)/1024
    $totalInGb = "{0:N2}" -f $totalInGb
    write-host "Total size of all sites below" $StartWeb "is" $total "Bytes,"
    write-host "which is" $totalInMb "MB or" $totalInGb "GB"
    $web.Dispose()
}

function GetWebSize ($Web)
{
    [long]$subtotal = 0
    foreach ($folder in $Web.Folders)
    {
        $subtotal += GetFolderSize -Folder $folder
    }
    write-host "Site" $Web.Title "is" $subtotal "KB"
    return $subtotal
}

function GetSubWebSizes ($Web)
{
    [long]$subtotal = 0
    foreach ($subweb in $Web.GetSubwebsForCurrentUser())
    {
        [long]$webtotal = 0
        foreach ($folder in $subweb.Folders)
        {
            $webtotal += GetFolderSize -Folder $folder
        }
        write-host "Site" $subweb.Title "is" $webtotal "Bytes"
        $subtotal += $webtotal
        $subtotal += GetSubWebSizes -Web $subweb
    }
    return $subtotal
}

function GetFolderSize ($Folder)
{
    [long]$folderSize = 0  
    foreach ($file in $Folder.Files)
    {
        $folderSize += $file.Length;
    }
    foreach ($fd in $Folder.SubFolders)
    {
        $folderSize += GetFolderSize -Folder $fd
    }
    return $folderSize
}

Once you have run the script, you can call it with the following PowerShell command:

GetWebSizes -StartWeb

Refrenceenter link description here

or Get Size of sub sites PowerShell Script SharePoint 2013

  • Thank you on reply. I will check it tomorrow when I get back to office. – Danilo Nov 23 '16 at 15:54
  • I am getting an error on GetWebSizes -Start URLofSite. The term 'GetWebSizes' is not recognized as the name of a cmdlet, function, script... – Danilo Nov 24 '16 at 8:28
  • Did you execute the whole code first? Save the complete code in a ps1 file then run it in powershell window....on the next line run the getwebsizes – Waqas Sarwar MVP Nov 24 '16 at 11:30
  • yes. as described on the page you provided. – Danilo Nov 24 '16 at 12:08

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.