Tuesday, January 12, 2016

Grabbing certain GB of Mailboxes From a DB

We have a few databases that are reaching capacity. These DBs are around 600-700gb in the 1 TB drives we used.

$TotalMoveSize=0;$move = @();get-mailbox -Database DB08 | %{$size = (get-mailboxstatistics -identity $_.identity).totalitemsize.value.tobytes();if ($totalMoveSize + $size -le 300gb){$totalMoveSize += $size;$Move+= $_.identity}}

This one-liner, will read DB08, and keep adding mailboxes to an array until at or near 300gb in size.

No comments:

Post a Comment