So for every item in the storage group list you need to run the
previous line of code, however you are also going to look for the database path as one of the variables
that are plugged into the standard message text. You can do this by piping the output of Get-EventLog
to another Where-Object . This Where-Object would need to use the $objItem variable to enumerate
through your list of mailbox stores. In particular you are going to look at the EdbFilePath property
because this is listed in the event.
Where-Object { $_.ReplacementStrings -like $objItem. EdbFilePath} | Select-Object
-first 1
Notice too that after you narrow down your list of events there is still the possibility of having more than
one event returned, so this example used Select-Object -first 1 to return only the first event from
the list, which by default is the newest. You are now all set; you can add a couple Write-Host cmdlets
to display the information that you are looking for. And you end up with the following script:
$servername = [System.Environment]::MachineName
$db = Get-StorageGroup -Server $servername | Get-MailboxDatabase
foreach ($objItem in $db)
{
$EventLogs = get-EventLog -LogName Application | Where-Object {$_.EventID -eq 703 -
or $_.EventID -eq 701 -and $_.Source -eq ???ESE??™ } | Where-Object
{$_.
Pages:
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661