Skip to content

Commit

Permalink
Merge pull request #1857 from microsoft/dpaul-DgFix
Browse files Browse the repository at this point in the history
Address not thrown Get-DynamicDistributionGroup error
  • Loading branch information
dpaulson45 committed Oct 19, 2023
2 parents 6329958 + 78c895c commit cc2e168
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
. $PSScriptRoot\Get-SecurityCve-2021-34470.ps1
. $PSScriptRoot\Get-SecurityCve-2022-21978.ps1
. $PSScriptRoot\..\..\..\..\Shared\ActiveDirectoryFunctions\Get-ExchangeADSplitPermissionsEnabled.ps1
. $PSScriptRoot\..\..\..\..\Shared\ErrorMonitorFunctions.ps1
. $PSScriptRoot\..\..\..\..\Shared\Invoke-CatchActionErrorLoop.ps1
function Get-OrganizationInformation {
[CmdletBinding()]
param(
Expand Down Expand Up @@ -74,7 +76,10 @@ function Get-OrganizationInformation {
}

try {
# It was reported that this isn't getting thrown to the catch action when failing. As a quick fix, handling this by looping over errors.
$currentErrors = $Error.Count
$getDdgPublicFolders = @(Get-DynamicDistributionGroup "PublicFolderMailboxes*" -IncludeSystemObjects -ErrorAction "Stop")
Invoke-CatchActionErrorLoop $currentErrors ${Function:Invoke-CatchActions}
} catch {
Write-Verbose "Failed to get the dynamic distribution group for public folder mailboxes."
Invoke-CatchActions
Expand Down

0 comments on commit cc2e168

Please sign in to comment.