From ed48ded4b74292207111b28f9f3a723502ebce2f Mon Sep 17 00:00:00 2001 From: Shane Ferrell Date: Thu, 20 Jun 2024 14:23:27 -0700 Subject: [PATCH 1/3] RBA Update --- Calendar/Get-RBASummary.ps1 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Calendar/Get-RBASummary.ps1 b/Calendar/Get-RBASummary.ps1 index 03edb2a9aa..c94ab21712 100644 --- a/Calendar/Get-RBASummary.ps1 +++ b/Calendar/Get-RBASummary.ps1 @@ -177,7 +177,6 @@ function RBACriteria { `t MaximumConflictInstances: $($RbaSettings.MaximumConflictInstances) `t MaximumConflictPercentage: $($RbaSettings.MaximumConflictPercentage) `t EnforceSchedulingHorizon: $($RbaSettings.EnforceSchedulingHorizon) - `t SchedulingHorizonInDays: $($RbaSettings.SchedulingHorizonInDays) "@ Write-Host -NoNewline "`r`nIf all the above criteria are met, the request is " Write-Host -ForegroundColor Yellow -NoNewline "In-Policy." @@ -273,14 +272,25 @@ function RBAProcessingValidation { } # Write out a list of Mailboxes +# We get CN from the cmdlet and want Display Name and Primary SMTP Address function OutputMBList { param ( [Parameter(Mandatory)] [string[]]$MBList ) foreach ($User in $MBList) { - $User = Get-Mailbox -Identity $User - Write-Host " `t `t [$($User.DisplayName)] -- $($User.PrimarySmtpAddress)" + # MS Support will error as we need the Organization to process from CN + if ($Identity -like "*@*") { + $Org = $Identity.Split('@')[1] + } + if ($null -ne $Org) { + $User = Get-Mailbox -Identity $User -organization $Org + Write-Host " `t `t [$($User.DisplayName)] -- $($User.PrimarySmtpAddress)" + } + else { + $User = Get-Mailbox -Identity $User + Write-Host " `t `t [$($User.DisplayName)] -- $($User.PrimarySmtpAddress)" + } } } From 4aa36628405ebf8a0161567360640366e3b4e120 Mon Sep 17 00:00:00 2001 From: Shane Ferrell Date: Thu, 20 Jun 2024 14:24:00 -0700 Subject: [PATCH 2/3] rba formatting --- Calendar/Get-RBASummary.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Calendar/Get-RBASummary.ps1 b/Calendar/Get-RBASummary.ps1 index c94ab21712..9ad12dc69e 100644 --- a/Calendar/Get-RBASummary.ps1 +++ b/Calendar/Get-RBASummary.ps1 @@ -286,8 +286,7 @@ function OutputMBList { if ($null -ne $Org) { $User = Get-Mailbox -Identity $User -organization $Org Write-Host " `t `t [$($User.DisplayName)] -- $($User.PrimarySmtpAddress)" - } - else { + } else { $User = Get-Mailbox -Identity $User Write-Host " `t `t [$($User.DisplayName)] -- $($User.PrimarySmtpAddress)" } From 4b2ff1eabfd75b49cde00d9657885cfbe9896c74 Mon Sep 17 00:00:00 2001 From: Shane Ferrell Date: Mon, 1 Jul 2024 13:33:45 -0700 Subject: [PATCH 3/3] Fix email split for Org --- Calendar/Get-RBASummary.ps1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Calendar/Get-RBASummary.ps1 b/Calendar/Get-RBASummary.ps1 index 9ad12dc69e..82884e23d5 100644 --- a/Calendar/Get-RBASummary.ps1 +++ b/Calendar/Get-RBASummary.ps1 @@ -280,9 +280,8 @@ function OutputMBList { ) foreach ($User in $MBList) { # MS Support will error as we need the Organization to process from CN - if ($Identity -like "*@*") { - $Org = $Identity.Split('@')[1] - } + $Org = $Identity.Split('@')[1] + if ($null -ne $Org) { $User = Get-Mailbox -Identity $User -organization $Org Write-Host " `t `t [$($User.DisplayName)] -- $($User.PrimarySmtpAddress)"