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'] }}
  }
End Function

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Respond to this post