Polar shell is very flexible and gives you the ability to generate very detailed reports and generate
a mailbox data statistics we can utilize data returned from multiple C'mon let's.
Provided by the Exchange management shell this leader will show you an example of this and you will
learn how to calculate the average mailbox size Bero database use and power shell suit to determine
that average mailbox size for a given database usually following in one line or get mailbox statistics
database D-B 20 or as in my case my lab defaulted B and then bibe the results two for each command left.
So for each object we get to litum size.
Well you're and converted to killer bytes because my lab databases are too small to be calculated in
kilobytes.
Let me pipe it to measure object.
Come on let's raise average parameter and pipe it to select object.
We use expand Broecker to perimeter calculate and the average is as simple as performing some basic
math.
But power still gives us the ability to do this correctly with a manager object.
Come on.
Let the example uses the get mailbox statistics command lead to retrieve all the mailboxes in the database
with a loop through each one retrieving Only a total item size property and insights inside the foreach
object script block we convert the total item size to kilobytes or you can convert to 2 megabytes gigabytes.
And so the result for each mailbox can then be leveraged using don't measure object come on land and
lay on top of the amount you can see that this select object come on clatters use to retrieve only the
value for the average property the number returned here will give us the average mailbox size in total
for regular mailboxes archive mailboxes as well as any other type of mailbox that has been disconnected.
If you want to be more specific you can filter out these mailboxes after running that get mailbox statistics
command led like in this example.
Notice that in this example they have added that their object commands let to filter out any mailboxes
that have a disconnect date defined or where or there is a required property is true.
The other thing that you might want to do is around the average let's say that D-B Trantor database
contained two mailboxes in my lab environment and the total size of the database is around some number.
The value returned from the command would roughly look like a 4.2 and lots of numbers after boy and
rarely are all those extra decimal places of any use.
So here are a couple of ways to make the output of a little cleaner.
Take a look at this code.
You can see that this time restored the results of the one liner in there.
And the average variable or if it's in kilobytes you could name it keep B K B average with only used
the round mass sort of the math class and the dot net framework around the well you specified that the
result should only contain two decimal places based on the previous information.
The result of the and command would be much more readable.
Getting rid of this unnecessary information after a point we can also use Drene for matter and for specifying
the number of decimal places to be used.
By the way the dash f format operator is documented in PowerShares cow.
And you can read all about it in about underscore operators help file.
Keep in mind that this command will return a stream.
So if you need to be able to sort on list while you're gasted to double like in this example the previous
examples have only shown how to determine the average mailbox size for a single database to determine
the incident information for all mailbox databases we can use the code I will run it from here.
But you can also save a file called to for example size dot one.
The result of this command would look something like mine.
This example is very similar to the one we looked at previously.
The difference is that this time around in our one line or use using a for reach for every mailbox database
in the organization when each mailbox database has been proceeded we searched out based on the average
mailbox size property.
So I've got some databases which are mounted and that every mailbox size in kilobytes for these databases
and lots of errors for dismounted databases.