Tuesday 5 June 2012

Exchange Database Size Reports

Continuing with our messaging “how tos”, the below exchange POWERSHELL script will help you to get Exchange Database Report:


Database Size Reports


$exchangeservers = Get-ExchangeServer |where-object {$_.admindisplayversion.major -eq 8 -and $_.IsMailboxServer -eq $true }


foreach ($server in $exchangeservers)

{

$db = Get-MailboxDatabase -server $server

foreach ($objItem in $db)

{

$edbfilepath = $objItem.edbfilepath

$path = "`\`\" + $server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2)

$dbsize = Get-ChildItem $path

$dbpath = $EdbFilePath.PathName.Remove(0,2).Replace(".edb","")

$ReturnedObj = New-Object PSObject

$ReturnedObj | Add-Member NoteProperty -Name "Server\StorageGroup\Database" -Value $objItem.Identity

$ReturnedObj | Add-Member NoteProperty -Name "Size (MB)" -Value ("{0:n2}" -f ($dbsize.Length/1024KB))

Write-Output $ReturnedObj

}

}



Note: Just copy past should work. I wish and hope it would!

No comments:

Post a Comment