The following script calculates the public folder size based on the public folder statistics output provided by Exchange Server 2007.
# Server name hosting legacy public folders
$Server = 'PUBLICFOLDERSERVER'
# Fetch legacy public folder statistics
$Folders = Get-PublicFolderStatistics -server $Server | Where-Object {($_.TotalItemSize -ne "0B")}
$TotalBytes = 0
# Let's do some string manipulation stuff
ForEach ($Item in $Folders) {
$TotalItemSize = $Item.TotalItemSize
$TotalItemSize = [string]$TotalItemSize
if ( ($TotalItemSize.contains('KB')) ) {
$TotalItemSize = $TotalItemSize -Replace ('KB','')
$TotalItemSize = [int]$TotalItemSize * 1024
}
$TotalItemSize = $TotalItemSize -Replace ('B','')
$TotalBytes = [long]$TotalItemSize + [long]$TotalBytes}
# Output as GB
[math]::round($TotalBytes/1Gb, 2)
Enjoy.
Kurz-URL | Short URL: https://granikos.eu/go/QGtk

