Skip to content

Commit

Permalink
Merge pull request #1891 from Shanefe/RBA-LogDetails
Browse files Browse the repository at this point in the history
Save RBA Log, RBA Logs summary, Better coverage of known issues
  • Loading branch information
dpaulson45 authored Dec 6, 2023
2 parents 584e12d + 7900353 commit 2f5ef4b
Showing 1 changed file with 80 additions and 26 deletions.
106 changes: 80 additions & 26 deletions Calendar/Get-RBASummary.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function ValidateMailbox {
if ($null -eq $script:Place) {
Write-Error "Error: Get-Place returned Null for $Identity."
Write-Host -ForegroundColor Red "Make sure you are running from the correct forest. Get-Place does not cross forest boundaries."
Write-Host "Hint Forest is likely something like: [$($script:Mailbox.Database.split("DG")[0])]."
Write-Error "Exiting Script."
exit
}
Expand Down Expand Up @@ -303,10 +304,10 @@ function OutOfPolicyProcessing {
Write-Host "`t AllRequestOutOfPolicy: "$RbaSettings.AllRequestOutOfPolicy

if ($RbaSettings.AllRequestOutOfPolicy -eq $true ) {
Write-Host "- All users are allowed to submit out-of-policy requests to the resource mailbox. Out-of-policy requests require approval by a resource mailbox delegate."
Write-Host -ForegroundColor Yellow "Information: - All users are allowed to submit out-of-policy requests to the resource mailbox. Out-of-policy requests require approval by a resource mailbox delegate."

if ($RbaSettings.RequestOutOfPolicy.count -gt 0) {
Write-Host -ForegroundColor Red "Warning: The users that are listed in BookInPolicy are overridden by the AllRequestOutOfPolicy as everyone can submit out of policy requests."
Write-Host -ForegroundColor Red "Warning: The users that are listed in RequestOutOfPolicy are overridden by the AllRequestOutOfPolicy as everyone can submit out of policy requests."
}
} else {
if ($RbaSettings.RequestOutOfPolicy.count -eq 0) {
Expand Down Expand Up @@ -342,26 +343,33 @@ function RBADelegateSettings {

if ($RbaSettings.ForwardRequestsToDelegates -eq $true ) {
if ($RbaSettings.AllBookInPolicy -eq $true) {
Write-Host -ForegroundColor Yellow "Warning: Delegate will not receive any In Policy requests as they will be AutoApproved."
Write-Host -ForegroundColor White "Information: Delegate(s) will not receive any In Policy requests as they will be AutoApproved."
} elseif ($RbaSettings.BookInPolicy.Count -gt 0 ) {
Write-Host -ForegroundColor Yellow "Warning: Delegate will not receive from users in the BookInPolicy."
Write-Host -ForegroundColor White "Information: Delegate(s) will not receive requests from users in the BookInPolicy as they will be AutoApproved."
foreach ($BIPUser in $RbaSettings.BookInPolicy) { Write-Host -ForegroundColor Yellow " `t `t $BIPUser " }
}

if ($RbaSettings.AllRequestOutOfPolicy -eq $false) {
if ($RbaSettings.RequestOutOfPolicy.Count -eq 0 ) {
Write-Host -ForegroundColor Yellow "Warning: Delegate will not receive any Out of Policy requests as they will all be AutoDenied."
Write-Host -ForegroundColor Yellow "Warning: Delegate(s) will not receive any Out of Policy requests as they will all be AutoDenied."
} else {
Write-Host -ForegroundColor Yellow "Warning: Delegate will only receive any Out of Policy requests from the below list of users."
Write-Host -ForegroundColor Yellow "Warning: Delegate(s) will only receive any Out of Policy requests from the below list of users."
foreach ($OutOfPolicyUser in $RbaSettings.RequestOutOfPolicy) { Write-Host "`t `t $OutOfPolicyUser" }
}
} else {
Write-Host -ForegroundColor Yellow "Note: All users can send Out of Policy requests to be approved by the Resource Delegates."
Write-Host -ForegroundColor Yellow "Warning: All users can send Out of Policy requests to be approved by the Resource Delegates."
}
}
} elseif ($RbaSettings.ForwardRequestsToDelegates -eq $true `
-and $RbaSettings.AllBookInPolicy -ne $true ) {
Write-Host -ForegroundColor Yellow "Information: ForwardRequestsToDelegates is true but there are no Delegates."
} else {
Write-Host -ForegroundColor Yellow "Warning: No Delegates are configured."
if ($RbaSettings.ForwardRequestsToDelegates -eq $true -and
$RbaSettings.AllBookInPolicy -ne $true ) {
Write-Host -ForegroundColor Yellow "Warning: ForwardRequestsToDelegates is true but there are no Delegates."
} if ($RbaSettings.RequestOutOfPolicy.Count -gt 0) {
Write-Host -ForegroundColor Red "Error: Users are listed in RequestOutOfPolicy but there are no Delegates. - All Out of policy requests by these users will be Tentatively accepted."
} if ($RbaSettings.AllRequestOutOfPolicy -eq $true) {
Write-Host -ForegroundColor Red "Error: AllRequestOutOfPolicy is set but there are no Delegates. - All Out of policy requests will be Tentatively accepted."
}
}
}

Expand Down Expand Up @@ -472,10 +480,15 @@ function VerbosePostProcessing {
#Add information about RBA logs.
function RBAPostScript {
Write-Host
Write-Host "If more information is needed about this resource mailbox, please look at the RBA logs to
Write-Host "If more information is needed about this resource mailbox, please look at the RBA logs saved in this directory to
see how the system proceed the meeting request."
Write-Host "To get new RBA Logs, run the following command:"
Write-Host -ForegroundColor Yellow "`tExport-MailboxDiagnosticLogs $Identity -ComponentName RBA"
Write-Host
Write-Host "To continue troubleshooting further, suggestion is to create a Test Meeting in this room (in the future, RBA does not process meeting in the past)."
Write-Host "and then pull the RBA Logs as well as the Calendar Diagnostic Objects to see how the system processed the meeting request."
Write-Host "For Calendar Diagnostic Objects, try [CalLogSummaryScript](https://github.com/microsoft/CSS-Exchange/releases/latest/download/Get-CalendarDiagnosticObjectsSummary.ps1)"

Write-Host "`n`rIf you found an error with this script or a misconfigured RBA case that this should cover,
send mail to [email protected]"
}
Expand All @@ -489,17 +502,24 @@ function RBALogSummary {

if ($RBALog.count -gt 1) {
$Starts = $RBALog | Select-String -Pattern "START -"
$FirstDate = "[Unknown]"
$LastDate = "[Unknown]"

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 "`tThe 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"
$UpdatedLogs = $RBALog | Select-String -Pattern "Begin ProcessUpdateRequest"
$SkippedExternal = $RBALog | Select-String -Pattern "Skipping processing because user settings for processing external items is false."
$DelegateReferrals = $RBALog | Select-String -Pattern "Forwarding Request To Delegates"
$NonMeetingRequests = $RBALog | Select-String -Pattern "Item is not a meeting request"
$Cancellations = $RBALog | Select-String -Pattern "It's a meeting cancellation."

if ($AcceptLogs.count -ne 0) {
$LastAccept = ($AcceptLogs[0] -Split ",")[0].Trim()
Expand All @@ -522,6 +542,52 @@ function RBALogSummary {
if ($AcceptLogs.count -eq 0 -and $TentativeLogs.count -eq 0 -and $DeclineLogs.count -eq 0) {
Write-Host -ForegroundColor Red "`t No meetings were processed in the RBA Log."
}

if ($UpdatedLogs.count -ne 0) {
$LastUpdated = ($UpdatedLogs[0] -Split ",")[0].Trim()
Write-Host "`t $($UpdatedLogs.count) Updates to meetings between $FirstDate and $LastDate"
Write-Host "`t`t with the last meeting updated on $LastUpdated"
} else {
Write-Host -ForegroundColor Red "`t No meetings were updated in the RBA Log."
}

if ($Cancellations.count -ne 0) {
Write-Host "`t $($Cancellations.count) Cancellations were processed."
} else {
Write-Host "`t No meetings were canceled in the RBA Log."
}

if ($DelegateReferrals.count -ne 0) {
$LastDelegateReferral = ($DelegateReferrals[0] -Split ",")[0].Trim()
Write-Host "`t $($DelegateReferrals.count) Delegate Referrals were sent between $FirstDate and $LastDate"
Write-Host "`t`t with the last Delegate Referral sent on $LastDelegateReferral"
} else {
Write-Host "`t No Delegate Referrals were sent in the RBA Log."
}

if ($NonMeetingRequests.count -ne 0) {
$LastNonMeetingRequest = ($NonMeetingRequests[0] -Split ",")[0].Trim()
Write-Host "`t $($NonMeetingRequests.count) Non Meeting Requests were skipped between $FirstDate and $LastDate"
Write-Host "`t`t with the last Non Meeting Request skipped on $LastNonMeetingRequest"
} else {
Write-Host "`t No Non Meeting Requests were skipped in the RBA Log."
}

if ($SkippedExternal.count -ne 0) {
if ($SkippedExternal.Count -lt 3) {
Write-Host "`t Warning: $($SkippedExternal.count) External meetings were skipped as processing external items is false."
} else {
Write-Host -ForegroundColor Red "`t Warning: $($SkippedExternal.count) External meetings were skipped as processing external items is false."
Write-Host -ForegroundColor Red "`t`t Many skipped external meetings may indicate a configuration issue in Transport."
Write-Host -ForegroundColor Red "`t`t Validate that Internal Meetings are not getting marked as External."
}
}

$Filename = "RBA-Logs_$($Identity.Split('@')[0])_$((Get-Date).ToString('yyyy-MM-dd_HH-mm-ss')).txt"
Write-Host "`r`n`t RBA Logs saved as [" -NoNewline
Write-Host -ForegroundColor Cyan $Filename -NoNewline
Write-Host "] in the current directory."
$RBALog | Out-File $Filename
} 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."
}
Expand Down Expand Up @@ -622,19 +688,6 @@ function ValidateRoomListSettings {
Write-Host
}

function Get-DashLine {
[CmdletBinding()]
[OutputType([string])]
param(
[Parameter(Mandatory = $true)]
[int]$Length,
[char] $DashChar = "-"
)
$dashLine = [string]::Empty
1..$Length | ForEach-Object { $dashLine += $DashChar }
return $dashLine
}

function Write-DashLineBoxColor {
[CmdletBinding()]
param(
Expand All @@ -652,7 +705,8 @@ function Write-DashLineBoxColor {
#>
$highLineLength = 0
$Line | ForEach-Object { if ($_.Length -gt $highLineLength) { $highLineLength = $_.Length } }
$dashLine = Get-DashLine $highLineLength -DashChar $DashChar
$dashLine = [string]::Empty
1..$highLineLength | ForEach-Object { $dashLine += $DashChar }
Write-Host
Write-Host -ForegroundColor $Color $dashLine
$Line | ForEach-Object { Write-Host -ForegroundColor $Color $_ }
Expand Down

0 comments on commit 2f5ef4b

Please sign in to comment.