Friday, July 11, 2014

Reporting Mount Points for Mailbox Servers

Hi Folks,

Recently I had one more adventure.

I extremely love my customers, especially those who have a good standardization and conventions in their infrastructure. One customer of mine had pretty strict requirements for size of LUNs for database files and transaction logs.

However 2 things happened. Once their backup had got broken which as you know would result of transaction logs not being truncated and disk space usage grow presenting the threat of dismounting of database. This resulted into extending size of LUNs used by transaction logs and further discrepancy in disk size.

So my task was to determine which LUNs don't have standard size so that their size can be squeezed back to a standard one. LUNs were presented to mailbox servers as mount points.

In order to discover their size I decided that I generate a script that would report information about mount points and generate a nice CSV files that can be later processed by Microsoft Excel.

My greatest thanks to the author of  this article as I used it as basis for my script.

First I defined variables so that data is output into CSV in gigabytes instead of bytes. And after that I defined a variable for all mount points which then I have output into CSV file.

And I ended up with script that exports information about absolutely all mount points that I have across my client's Exchange estate:

$TotalGB = @{Name="Capacity(GB)";expression={[math]::round(($_.Capacity/ 1073741824),2)}}
$FreeGB = @{Name="FreeSpace(GB)";expression={[math]::round(($_.FreeSpace / 1073741824),2)}}
$FreePerc = @{Name="Free(%)";expression={[math]::round(((($_.FreeSpace / 1073741824)/($_.Capacity / 1073741824)) * 100),0)}}

$MPoints = Get-MailboxServer |foreach {Get-WmiObject -computer $_.Name win32_volume | Where-object {$_.DriveLetter -eq $null}} 
$Mpoints |Select SystemName,Name, Label, $TotalGB, $FreeGB, $FreePerc |Export-Csv D:\Scripts\Mount_Points_All.csv

I have also done some tweak to make output of a particular mount points I was interested in. I needed information of all mount points which are larger than 100 GB and smaller than 855 GB, so I ended up with the filter {$_.Capacity -gt  107374182400 -and $_.Capacity -lt  918049259520} which is calculated by converting GB into bytes, so the code looked like:

$MPoints |Where-object {$_.Capacity -gt  107374182400 -and $_.Capacity -lt  918049259520} | Select SystemName,Name, Label, $TotalGB, $FreeGB, $FreePerc| sort-object SystemName,Label | Export-Csv D:\Scripts\MountPoints_Oversized.csv

And of course you can come up with different other filters that will allow you to extract the exact information you may need.

In my case I have ended up with the nice Excel file as below:



Enjoy.



No comments:

Post a Comment