Hi everyone,
the sun is shining in Buenos Aires and with the summer breeze my mood is better than yesterday :)..I would to share with you this simple script that search the Event 1221 in all mailbox servers and get the DB's white space in MB...the result will be exported to a csv file, see the code below:
$ComputerName =Get-ExchangeServer |where {$_.IsMailboxServer -eq 'True'}
$dmtf = [System.Management.ManagementDateTimeconverter]
$Start = $dmtf::ToDmtfDateTime( (Get-Date).AddDays(-1).Date )
$db = @{Name="DB";Expression={$_.InsertionStrings[1]}}
$free = @{Name="WhiteSpace(MB)";Expression={[int]$_.InsertionStrings[0]}}
$filter = "LogFile='Application' AND EventCode=1221 AND TimeWritten>='$Start'"
Get-WMIObject Win32_NTLogEvent -ComputerName $ComputerName -Filter $filter | select ComputerName,$db,$free | export-csv salida.csv -Force -NoTypeInformation
Enjoy!
-Dario