Ok so another scrip I just wrote as a result of some recent issues. (thank goodness for powershell). This script will return the size of your transaction log locations on a particular server. It’s almost universal. The only thing that needs to be customized is the second parameter in the substring method. The section of the script used for getting the folder sizes I got from technet.


The value of 10 is the number of characters into the string to start trimming. So if you have a string of “d:\Transactionlogsgohere”. You would want to set the value to 24. This is also assuming you have created your transaction log locations as sub folders below the substring path. For example:


Add-PSSnapin microsoft.exchange.management.powershell.admin -ErrorAction SilentlyContinue

#get current server name
$server = $env:COMPUTERNAME

#determine current server log paths
$DBs = (Get-MailboxDatabase -Server $server | select name,LogFolderPath)
$paths = $DBs | ForEach-Object {
    $logpath = $_.LogFolderPath.ToString()
$pathtoscan = $paths | Sort-Object -Unique

#get sizes of each log folder
Write-Host "Scanning --" $server
$folders = Get-ChildItem $pathtoscan | where {$_.PSIsContainer -eq $True} | Sort-Object
foreach ($folder in $folders) {
    $subFolderItems = (Get-ChildItem $folder.FullName | Measure-Object -property length -sum)
    $folder.Name + " -- " + "{0:N2}" -f ($subFolderItems.sum / 1MB) + " MB"

So like I said, almost universal. 🙂 It’s very handy for quickly identifying mailbox databases with large amounts of un-truncated transaction logs.