get properties of a distribution group

Welcome Forums General PowerShell Q&A get properties of a distribution group

This topic contains 7 replies, has 4 voices, and was last updated by

 
Participant
3 months, 3 weeks ago.

  • Author
    Posts
  • #130878

    Participant
    Points: 0
    Rank: Member

    Hi – i am trying to find the description,RecipientPermission,displayname,managedby(owner),requiresenderauthenticationenabled(if allowed to send from outsider),Membercount,PrimarySMTP.

     

    I am able to get get all but description and RecipientPermission from below. How do I incorporate that into the below?

     

    Get-DistributionGroup -ResultSize unlimited | select DisplayName,Managedby,RequireSenderAuthenticationEnabled,@{n="MemberCount";e={(Get-DistributionGroupMember $_.PrimarySmtpAddress | measure).Count}},PrimarySmtpAddress | Export-CSV C:\DlistCleanup.CSV
  • #131090

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    The command may not return that information. Have you tried:

     

    Get-DistributionGroup -ResultSize unlimited | Format-List *

     

    ?

  • #131127

    Participant
    Points: 71
    Rank: Member

    to get those results you would use get-adgroup and get-adpermissions for the description field and permissions

     

    • #131328

      Participant
      Points: 0
      Rank: Member

      to get those results you would use get-adgroup and get-adpermissions for the description field and permissions

      thank you. But how can i add them to my script? I dont want to use a different script and pull both spreadsheets and compare. There are too many columns to go through.

  • #131163

    Participant
    Points: 47
    Rank: Member

    Don's right, this worked for me:  Get-DistributionGroup -ResultSize unlimited | Format-List DisplayName,Managedby,RequireSenderAuthenticationEnabled.

    However, to get the member count of all Distribution groups is another process.  Paul Cunningham can help you with that:  https://practical365.com/exchange-server/get-distribution-group-member-counts-with-powershell/

  • #131325

    Participant
    Points: 0
    Rank: Member

    Get-DistributionGroup -ResultSize unlimited | select DisplayName,Managedby,RequireSenderAuthenticationEnabled,@{n="MemberCount";e={(Get-DistributionGroupMember $_.PrimarySmtpAddress | measure).Count}},PrimarySmtpAddress | Export-CSV C:\DlistCleanup.CSV

    The above works and returns the displayname, Managedby, Required Authentication Enabled, Memeber count and SMTP.

    I also need the Description and Recipient Permission. How do i add this to the above script?

  • #131363

    Participant
    Points: 47
    Rank: Member

    I'm afraid that won't work.  Your custom property is using the command "get-distributiongroupmember" as the scriptblock expression for "MemberCount".  It's not a property of the incoming objects produced by Get-DistributionGroup.  You won't get any results for member count.

  • #131691

    Participant
    Points: 0
    Rank: Member

    actually this worked
    Get-DistributionGroup -resultsize unlimited | select displayName,Managedby,RequireSenderAuthenticationEnabled,@{n="MemberCount";e={(Get-DistributionGroupMember $_.PrimarySmtpAddress | measure).Count}},@{n="Description";e={(Get-adgroup $_.samaccountname -properties description).description}},PrimarySmtpAddress,AcceptMessagesOnlyFromSendersOrMembers | Export-CSV C:\DlistCleanup.CSV

The topic ‘get properties of a distribution group’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort