Skip to content

Commit

Permalink
Check for dynamic distribution group for pf mailboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulson45 committed Oct 4, 2023
1 parent 438ba8a commit 2dedf60
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,33 @@ function Invoke-AnalyzerOrganizationInformation {
}
Add-AnalyzedResultInformation @params
}

if ($null -ne $organizationInformation.GetDynamicDgPublicFolderMailboxes -and
$organizationInformation.GetDynamicDgPublicFolderMailboxes.Count -ne 0) {
$displayWriteType = "Green"

if ($organizationInformation.GetDynamicDgPublicFolderMailboxes.Count -gt 1) {
$displayWriteType = "Red"
}

$params = $baseParams + @{
Name = "Dynamic Distribution Group Public Folder Mailboxes Count"
Details = $organizationInformation.GetDynamicDgPublicFolderMailboxes.Count
DisplayWriteType = $displayWriteType
}

Add-AnalyzedResultInformation @params

if ($displayWriteType -ne "Green") {
$params = $baseParams + @{
Details = "More Information: https://aka.ms/HC-DynamicDgPublicFolderMailboxes"
DisplayCustomTabNumber = 2
DisplayWriteType = "Yellow"
}

Add-AnalyzedResultInformation @params
}
} else {
Write-Verbose "No Dynamic Distribution Group Public Folder Mailboxes found to review."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ function Get-OrganizationInformation {
$wellKnownSecurityGroups = Get-ExchangeWellKnownSecurityGroups
$isSplitADPermissions = Get-ExchangeADSplitPermissionsEnabled -CatchActionFunction ${Function:Invoke-CatchActions}

try {
$getDdgPublicFolders = @(Get-DynamicDistributionGroup "PublicFolderMailboxes*" -IncludeSystemObjects -ErrorAction "Stop")
} catch {
Write-Verbose "Failed to get the dynamic distribution group for public folder mailboxes."
Invoke-CatchActions
}

try {
$rootDSE = [ADSI]("LDAP://$([System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain().Name)/RootDSE")
$directorySearcher = New-Object System.DirectoryServices.DirectorySearcher
Expand Down Expand Up @@ -123,18 +130,19 @@ function Get-OrganizationInformation {
}
} end {
return [PSCustomObject]@{
GetOrganizationConfig = $organizationConfig
DomainsAclPermissions = $domainsAclPermissions
WellKnownSecurityGroups = $wellKnownSecurityGroups
AdSchemaInformation = $adSchemaInformation
GetHybridConfiguration = $getHybridConfiguration
EnableDownloadDomains = $enableDownloadDomains
GetAcceptedDomain = $getAcceptedDomain
MapiHttpEnabled = $mapiHttpEnabled
SecurityResults = $securityResults
IsSplitADPermissions = $isSplitADPermissions
ADSiteCount = $adSiteCount
GetSettingOverride = $getSettingOverride
GetOrganizationConfig = $organizationConfig
DomainsAclPermissions = $domainsAclPermissions
WellKnownSecurityGroups = $wellKnownSecurityGroups
AdSchemaInformation = $adSchemaInformation
GetHybridConfiguration = $getHybridConfiguration
EnableDownloadDomains = $enableDownloadDomains
GetAcceptedDomain = $getAcceptedDomain
MapiHttpEnabled = $mapiHttpEnabled
SecurityResults = $securityResults
IsSplitADPermissions = $isSplitADPermissions
ADSiteCount = $adSiteCount
GetSettingOverride = $getSettingOverride
GetDynamicDgPublicFolderMailboxes = $getDdgPublicFolders
}
}
}

0 comments on commit 2dedf60

Please sign in to comment.