Skip to content

Commit

Permalink
Merge pull request #1822 from Shanefe/RBA_Script_Add_RBA_Log_Summary
Browse files Browse the repository at this point in the history
Add RBA Logs to summary
  • Loading branch information
tweekerz authored Sep 12, 2023
2 parents 0c1572b + 8c54fec commit 3a2c9e9
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Calendar/Get-RBASummary.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,47 @@ function RBAPostScript {
send mail to [email protected]";
}

function RBALogSummary {
Write-DashLineBoxColor @("RBA Log Summary") -Color blue -DashChar =

$RBALog = (Export-MailboxDiagnosticLogs $Identity -ComponentName RBA).MailboxLog -split "`\n"

if ($RBALog.count -gt 1) {
$Starts = $RBALog | Select-String -Pattern "START -"

if ($starts.count -gt 1) {
$LastDate = ($Starts[0] -Split ",")[0].Trim()
$FirstDate = ($starts[$($Starts.count) -1 ] -Split ",")[0].Trim();
Write-Host "The RBA Log for $Identity shows the following:"
Write-Host "`t $($starts.count) Processed events times between $FirstDate and $LastDate"
}

$AcceptLogs = $RBALog | Select-String -Pattern "Action:Accept"
$DeclineLogs = $RBALog | Select-String -Pattern "Action:Decline"
$TentativeLogs = $RBALog | Select-String -Pattern "Action:Tentative"

if ($AcceptLogs.count -ne 0) {
$LastAccept = ($AcceptLogs[0] -Split ",")[0].Trim()
Write-Host "`t $($AcceptLogs.count) were Accepted between $FirstDate and $LastDate"
Write-Host "`t`t with the last meeting Accepted on $LastAccept"
}

if ($TentativeLogs.count -ne 0) {
$LastTentative = ($TentativeLogs[0] -Split ",")[0].Trim()
Write-Host "`t $($TentativeLogs.count) Tentatively Accepted meetings between $FirstDate and $LastDate"
Write-Host "`t`t with the last meeting Tentatively Accepted on $LastTentative"
}

if ($DeclineLogs.count -ne 0) {
$LastDecline = ($DeclineLogs[0] -Split ",")[0].Trim()
Write-Host "`t $($DeclineLogs.count) Declined meetings between $FirstDate and $LastDate"
Write-Host "`t`t with the last meeting Declined on $LastDecline"
}
} else {
Write-Warning "No RBA Logs found. Send a test meeting invite to the room and try again if this is a newly created room mailbox."
}
}

function Get-DashLine {
[CmdletBinding()]
[OutputType([string])]
Expand Down Expand Up @@ -509,4 +550,5 @@ OutOfPolicyProcessing
RBADelegateSettings
RBAPostProcessing
VerbosePostProcessing
RBALogSummary
RBAPostScript

0 comments on commit 3a2c9e9

Please sign in to comment.