OneLiner: Determine the size of a public folder (and it’s subfolder)

We recently had the request to determine the size of a public folder. Not a problem at all, this should do the trick:

[PS] C:\Windows\system32>Get-PublicFolder "\[Foldername]" | Get-PublicFolderStatistics | Select TotalItemSize

… not really. All we get is the summarized size of the items included in this specific folder. Subfolders and items in subfolders will be ignored. But there is another way which will include subfolder sizes. Here you go:

[PS] C:\Windows\system32>Get-PublicFolder "\[Foldername]" -Recurse | Get-PublicFolderStatistics | Measure TotalItemSize -sum

Optically improved version:

[PS] C:\Windows\system32>Get-PublicFolder "\[Foldername]" -Recurse | Get-PublicFolderStatistics | Measure TotalItemSize -sum | Select @{N='Anzahl der Items'; E={$_.Count}}, @{N='Speicher in Byte'; E={$_.Sum}} | fl

Please be aware that this oneliner may takes some time to complete your request.

Leave a Reply

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