Get-MailboxDatabase | sort Name | %{write-host $_.name; $_ | Get-MailboxStatistics | select database,@{Name="DeletedItemSize";Expression={$_.totalDeletedItemSize.value.tomb()}} | measure-object -property DeletedItemSize -sum } | %{($_.sum).tostring() + "MB"}
This dumps to the screen a report that looks like:
HR-DB01
10875MB
HR-DB02
8597MB
HR-DB03
7535MB
I take this to mean that DB1 should grow by ~10GB in size when I double the DeletedItemRetention period to 4 weeks.
Revision 2: Returns an Object..
Get-MailboxDatabase | select Name,@{Name="DIR";Expression={ %{ $_ | Get-MailboxStatistics | select database,@{Name="DeletedItemSize";Expression={$_.totalDeletedItemSize.value.tomb()}} | measure-object -property DeletedItemSize -sum } | %{$_.sum}}} | sort DIR
Name DIR
---- ---
SALES-DB03 10944
SALES-DB01 10990
SALES-DB02 11008
Revision 3: Add Physical DB size.
Get-MailboxDatabase -status | select Name,@{Name="DIR";Expression={ %{ $_ | Get-MailboxStatistics | select database,@{Name="DeletedItemSize";Expression={$_.totalDeletedItemSize.value.tomb()}} | measure-object -property DeletedItemSize -sum } | %{$_.sum}}},@{Name="PhysicalDBSize";Expression={$_.databaseSize.tomb()}}
Now, I can filter the results to show only those that might exceed the 1TB mount points I have each DB. If for example I feed all of the above into a variable, $AllDBS. Then I can filter, when the results are going to be greater than, or close to our 1TB mount points.
For DBs that would be larger than 600MB in size.
$AllDBS | ?{(($_.dir*2) + $_.physicaldbsize) -ge 600000}
Name DIR PhysicalDBSize
---- --- --------------
IT-DB02 15643 588553
IT-DB03 11989 604681
IT-DB05 12975 663946
IT-DB01 16987 661641
No comments:
Post a Comment