Accept or reject messages from

This function reads delivery restrictions from objects in Active Directory. By default it looks at Groups. As the same information can be returned using Get-DistributionGroup or Get-Mailbox using Exchange 2007; this function is aimed at Exchange 2003.

function Get-SendToPermissions { param( [String]$Identity, [String]$SearchRoot = $null, [String]$LDAPFilter = "(objectCategory=group)", [Switch]$GC ) if ($GC) { $Port = "GC" } else { $Port = "LDAP" } if ($SearchRoot) { $SearchRoot = [ADSI]"$Port://$SearchRoot" } $Properties = @("name", "distinguishedName", "dLMemSubmitPerms", "dLMemRejectPerms", "authOrig", "unauthOrig", "msExchRequireAuthToSendTo") $Searcher = New-Object DirectoryServices.DirectorySearcher($SearchRoot, $LDAPFilter) $Searcher.PageSize = 1000 $Searcher.PropertiesToLoad.AddRange($Properties) $Searcher.FindAll() | Select-Object ` @{n='Name';e={ $.Properties['name'] }}, @{n='DN';e={ $.Properties['distinguishedname'] }}, @{n='RequireAuthToSendTo';e={ if ($.Properties['msexchrequireauthtosendto']) { $true } Else { $false } }}, @{n='AcceptFromMembersOfGroup';e={ $.Properties['dlmemsubmitperms'] }}, @{n='RejectFromMembersOfGroup';e={ $.Properties['dlmemrejectperms'] }}, @{n='AcceptFromUsers';e={ $.Properties['authorig'] }}, @{n='RejectFromUsers';e={ $_.Properties['unauthorig'] }} } }