Recursively get distribution list members

Hi,
I've been asked to supply the membership of several of our large distribution lists.  However, these lists are heavily nested, so I need to get membership recursively starting from the top level list.  The old ONDL.EXE utility could do this.  I was wondering if there was a powershell command that could accomplish the same thing.  The get-distributiongroupmember cmdlet does not seem to have recursive abilities.  If not, could someone help me with a script to do this?
Thanks,
Don

This is kind of long, but works:
(watch line wraps)
Save it as something like get-exgrouprecurse.ps1, and call it like this:
$members  = get-exgrouprecurse <group name>
Then, $members will contain all the members full objects, and the group name they are actually in
Code Snippet
# Script to retreive group members #
# Karl Mitschke March 7 2008 #
# heavily modified from recipe 7.3 #
# in 'Active Directory Cookbook' #
# by Robbie Allen #
#requires -pssnapin Microsoft.Exchange.Management.PowerShell.Admin
param($group)
$UnknownGroup = @{}
function DisplayMembers($group)
$SubGroup = @{}
$AllMembers = @()
if(!$group)
$group = Read-Host "Enter the groups display name"
if ($group.Contains("'"))
$group = $group.Replace("'",'"')
if ($group -eq "/?")
Write-Host "Usage:"
Write-Host ""
Write-Host "get-exgrouprecurse -group <group name>"
Write-Host ""
Write-Host "or get-exgrouprecurse <group name>"
Write-Host "Returns an object containing the group member, and the group name."
break
$validate = Get-Group $group
if ($validate.RecipientTypeDetails.ToString() -match "mail")
$searchGroup = Get-DistributionGroupMember $group
if ($searchGroup)
foreach ($member in $searchGroup)
$membertype = $member.RecipientTypeDetails
if($membertype -match "Group")
$samname = $member.SamAccountName.ToString()
if ($SubGroup.ContainsKey($samname) -eq $true)
Write-Output "^ already seen group member (stopping to avoid loop)"
else
$SubGroup.Add($samname,$member.DisplayName.ToString())
else
if($member.PrimarySmtpAddress -and $member.RecipientTypeDetails -notcontains "group")
$obj = new-object psObject
$obj | Add-Member -membertype noteproperty -name GroupMember -Value $member
$obj | Add-Member -MemberType noteproperty -Name GroupName -Value $group
$AllMembers += $obj
else
$UnknownGroup.add($group,1)
if($SubGroup.Values.Count -gt 0)
foreach ($subGroup in $SubGroup.values)
DisplayMembers $subGroup
if ($UnknownGroup.Keys.Count -gt 0)
foreach ($LostGroup in $UnknownGroup.keys)
$obj = new-object psObject
$obj | Add-Member -membertype noteproperty -name GroupMember -Value "Cannot enumerate group"
$obj | Add-Member -MemberType noteproperty -Name GroupName -Value $LostGroup
$AllMembers += $obj
$UnknownGroup.Clear()
else
Write-Output "$group does not appear to be mail enabled."
Write-Output $AllMembers
DisplayMembers $group

Similar Messages

  • Is there any function module for getting distribution list name

    Hi all,
    Is there any function module for getting distribution list name when there is same description for two distribution list name.
    or
    help me how to fetch the correct distribution name when there is same description.
    In order to send mails.
    Tell me ASAP.
    thanks
    sagar.

    http://www.sapbrainsonline.com/REFERENCES/FunctionModules/SAP_function_modules_list.html
    list of Fms

  • Unity 4.x - Limits of Distribution List members

    Is there a limit to how many members you can add to a public and/or private distribution list in Unity 4.2?

    Hi Johnny,
    Subscribers > Class of Service > Features Page 
    Lists Available to Subscribers
    Enter a number between one and 99 to specify the maximum number of private lists available to subscribers who are assigned to this COS. Subscribers can manage their private lists by phone and from the Cisco Unity Assistant.
    Though both the Cisco Unity conversation and the Cisco Unity Assistant use this setting to determine when a subscriber has reached the maximum number of lists, consider that each application calculates the number of lists that a subscriber owns differently:
    •When a subscriber tries to use the phone to create a new list by adding members, the Cisco Unity conversation counts the number of private lists that have members, and then compares the total to the value in this setting to determine whether the subscriber has reached the list limit. Lists with no members (empty lists) are not included in the total number of lists that a subscriber owns, even if the lists have recorded names and/or text names.
    •When a subscriber tries to use the Cisco Unity Assistant to create a new list, the Cisco Unity Assistant counts the number of lists that have a recorded voice name, a text name or members, and then compares the total to the value in this setting to determine whether the subscriber has reached the list limit. Lists with no members are included in the total number as long as they have recorded names and/or text names.
    This means that if a subscriber belongs to a class of service that allows 15 lists, and the subscriber has 12 private lists with members and two lists with recorded names but no members, the subscriber can potentially create more lists by phone than in the Cisco Unity Assistant before reaching the list limit:
    •When the subscriber uses the Cisco Unity conversation, the subscriber will reach the list limit either by adding members to the two empty lists and creating one new list, or by creating three new lists. If the subscriber reaches the limit by creating three new lists, the subscriber cannot add members to the two empty lists until two lists are deleted.
    •When the subscriber uses the Cisco Unity Assistant, the subscriber will reach the list limit by creating one new list. Despite reaching the list limit, the subscriber can add members to the two empty lists.
    You can set up private lists for a subscriber on the applicable Subscribers > Subscribers > Private Lists page, though the subscriber is the only person who can send voice messages to the list.
    Maximum Members Per List
    Enter a number between one and 999 to specify the maximum number of members that subscribers can add to a private list when they use the Cisco Unity conversation or the Cisco Unity Assistant. (There is no limit imposed on the number of members that can be added to a private list when you use the Subscribers > Subscribers > Private Lists page to add members to a list.)
    The subscriber is the only person who can send voice messages to the lis
    http://www.cisco.com/en/US/docs/voice_ip_comm/unity/405/administration/guide/ex/sag_0150.html
    Cheers!
    Rob

  • How Do I Manage "Group"/"Distribution List" Members?

    I downloaded iCloud recently to my android smart phone.  I use Outlook 2007 as my mail program.  When I"m on my pc (MS 8.1) & check my contacts, I find my "distribution lists"/'Groups" in a new list on the left side, but I cannot open these "lists/groups" therefore,  I cannot manage membership on them.   The "groups" won't open to show me who the members are.
    How do I solve this question?

    In Contacts, you can create Groups, of course. First and best, make the Groups visible (Command-1, or click View in the menu bar, then Groups).
    You add contacts to Groups per simple drag and drop. You delete contacts from Groups by pressing backspace, or delete (if you have the extended keyboard), or -> Edit -> Remove From Group.

  • Get distribution list api for ios application.

    Hi , I have used resolvenames api to get list of contacts which matches the string which was entered in to field of compose email screen, so similarly I have to get list of distribution group which matches the string which was entered in to field of compose
    email screen.
    I have tried using api like FindItem but was not able to get the distribution list, so please help if anyone knows what is the exact api or request xml to get the distribution list.

    Distribution groups are an interesting case because some live in the Active Directory, and some live in user's contact folders. There's a pretty good write up here:
    http://msdn.microsoft.com/en-us/library/office/dn629393(v=exchg.150).aspx. ResolveNames should find distribution groups though.

  • "changes to the distribution list membership cannot be saved. you do not have sufficient permission to perform this operation on this object"

    Running Exchange 2010/latest updates on Windows 2008 R2 servers.
    When I create a new DL that I want someone to manage, they received the following message when trying to add/remove from the DL:
    "changes to the distribution list membership cannot be saved.  you do not have sufficient permission to perform this operation on this object"
    I have followed everything in "http://msexchangeteam.com/archive/2009/11/18/453251.aspx" with no luck
    Any suggestions?

    Piggybacking off of the discussion above, with our deployment of Exchange 2007, we created a set of web-based tools that allowed people to create Exchange Resources including distribution lists.  To allow multiple people to manage the lists for a given
    department, we programmatically created a group, which is populated with one or more users from the "resource department".  We then set the following AD permissions to allow members of the group to manage membership of departmental distribution lists:
    Add-ADPermission -User DepartmentalGroup -AccessRights ReadProperty, WriteProperty -Properties 'Member' -DomainController dc.contoso.com
    Fast forward to Exchange 2010 and the landscape has changed with Exchange 2010's implementation of Role Based Access Control and I'm struggling to come up with a way to programmatically allow a group of users to manage distribution list membership for a
    subset of distribution lists - note that we have approximately 75 departments, with each having its own set of coordinators who should be able to manage distribution lists for their department but not lists created by other departments.  The specific
    error we receive in Outlook when attempting to modify group membership is the same as the title of this thread - "Changes to the distribution list membership cannot be saved.  You do not have sufficient permission to perform this operation on this object". 
    I implemented the settings referred to at
    http://sysadmin-talk.org/2010/06/omg-allowing-end-users-to-manage-distribution-group-membership-in-exchange-2010-2/ which details the process of creating a new management role and revoking the role's ability to create new distribution lists and remove distribution
    lists (which we want because we want those actions to be performed using our web tools). 
    All that to say that the ultimate problem we have is that the above relies on the "ManagedBy" field of a distribution list (viewable by Get-DistributionList Listname | fl *ManagedBy*) to determine group ownership.  When "ManagedBy" is set to a user,
    the user CAN edit a distribution list's membership from Outlook and OWA.  When "ManagedBy" is set to a group, members of the group are UNABLE to edit the membership of the distribution list via Outlook or Outlook Web Access/ECP.   Furthermore,
    Set-DistributionGroup does not allow you to specify a list of users to assign to the ManagedBy field.  However, if "ManagedBy" was set to a specific user and that user logs in to the Exchange Control Panel and adds additional "owners" of the distribution
    list, which I can then see from EMS - both the original owner and any additional owners added can in turn modify group membership for the list using Outlook or Outlook Web Access/ECP.
    My questions:
    1) Is it "expected" behavior that while I can assign a group to the "ManagedBy" property of distribution list, members of that group are still unable to edit the group membership?  ...or is there a fix for the behavior I'm seeing?
    2) Can multiple values be assigned to the "ManagedBy" property when using Set-DistributionList - ex: Set-DistributionList DLName -ManagedBy:user1,user2
    3) Any other suggestions?
    Thanks,
    -Lance

  • Distribution List administration not working?

    Hello out there...
    Not a GroupWise guru by any means...hoping I overlooked something simple....Groupwise 7.03 server and client system...we are just trying to get Distribution List Administration working and are testing it out amongst ourselves (admins)...so in Consoleone we use the Groupwise/Administration tab, add ourselves...it shows up for our user ID's in the Distribution List administration tab...but in the Windows client when trying to modify the list the add/remove buttons are greyed out. What am I doing wrong? Thanks.

    Originally Posted by jshorr
    Hello out there...
    Not a GroupWise guru by any means...hoping I overlooked something simple....Groupwise 7.03 server and client system...we are just trying to get Distribution List Administration working and are testing it out amongst ourselves (admins)...so in Consoleone we use the Groupwise/Administration tab, add ourselves...it shows up for our user ID's in the Distribution List administration tab...but in the Windows client when trying to modify the list the add/remove buttons are greyed out. What am I doing wrong? Thanks.
    Have you corrected this. I'm seeing the same thing and can't figure it out.
    It seems to have started after moving GW from Netware to Linux but not sure.
    Thanks for any reply you may have.

  • Some members of distribution list get email 15 minutes after the others

    We have a strange problem. We've migrated cross forrest from an Exchange 2007 to an Exchange 2013. Everything seems to be ok, except for one issue we have which is that sometimes an email sent to a distribution group is received 15 minutes later by 2 - 3
    of the users within the list. 
    The list contain 42 members, and I can see that the email is "sitting" on one server for the 15 minutes in question by reading the header of the email. The problem is not consistent. 
    Expansionserver is $null on all of my distribution lists, and I can have issues on other lists aswell, although that might just get noticed.
    If I try the tracker tool in EMC or through the gui (ecp) I get a "to many items in array" error. So I can't see anything in my exchange shells either. 
    All the users in the list are in the same domain, but the users are spread across 2-3 exchange servers. The server that the mail is "sitting" in, oddly has 0 of the members within the distlist. 
    any advice as to where to look is appreciated. if it is a problem with the expansionserver I would be greatful for any steps to find out how that can be determined or even better, be resolved. 

    There are 4 exchange 2013 servers which migrated from Exchange 2007 server in a differnt forrest and on another domain 
    Ex01: userA, userB, userC, userD
    Ex02: userE, userF
    Ex03: userG, userH
    DL: userA, userB, userC, userE
    Scenario:
    1. Email is sent to DL by user A, and user A , and he gets
    his own email after 15 minutes (verified by header). It has hanged on Ex03 for 15 mins (nothing in the ev log on the server).
    2. user B gets the mail instantly and user E gets it delayed
    (actually 40 got it spot on (after 3-4 seconds) three got it after 15 mintues.
    If I send directly to the user, there are NO delays at all.

  • How to get administrations of distribution list using api?

    I want get all administrations of a distribution list using api, how to do that?
    anybody knows? Thank you very much!!

    there is a standard function in mdm wd component
    https://help.sap.com/saphelp_nwmdm71/helpdata/en/loio30bf76947bb64c48a2e835fda42c5183_30bf76947bb64c48a2e835fda42c5183/4…
    "Note The Compare to Original button on the Items Detail component opens a Compare component enabling a user to compare a checked out record with an original record (if the user has authorization for the checked out group).
    If the checked out record is a result of a merge action, then the Compare view displays all the original records prior to the merge. When a merge action is executed on a number of checked out records, the merged record is also checked out."

  • Getting permissions on distribution lists in exchange server programmatically

    Hi All,
    Is there any way to get the permissions of current user on distribution lists in exchange server?
    dinesh

    You cannot use distribution list to assign permission on sharepoint server.
    You can use LDAP protocol to query and get user details from Distribution list and then assign permission. you will have to custom code this
    If this helped you resolve your issue, please mark it Answered

  • Distribution list. Get emails

    Hi forum,
    I have created a distribution list via tcode so23. I want to do a report or a function to send email to these address maintained in that distribution.
    How can i get these emails? Any table or standar function module to get it?
    Regards and thanks in advance.
    Mon

    Hi Bruno,
    It appears this is the function i have to use, but launch an exception when I run the funcion. The exception is that the distribution list doesnt exit: DL_NAME_NOT_EXIST
    I have created a list in tcode: so23, but i dont know if i have to do more steps...something more to the list.
    Regards and thanks.
    Mon
    Edit: Solved. I have to set: SHARED_DLI = 'X'.
    Thanks Bruno!
    Edited by: Peruches on Oct 10, 2008 9:48 AM

  • How to show the members of a MS Exchange Distribution List

    Hello,
    Can anyone tell me how I can take a look at the members of a MS Exchange Distribution List? I'm not using Entourage, but I use the Address Book preference "Sync with Exchange".
    Thanks!

    In addition to BalusC's comments, take a look at this [blog entry|http://www.ilikespam.com/blog/el-function-parameters-with-jboss-el] on JBoss EL. It's compatible with the unified EL, but adds parameters to method calls, and supports the resolution of items such as Collection.size().
    The blog shows how to configure the custom EL with Mojarra. Pretty straight forward.

  • Using 31.1.0 on Mac & sending to distribution list, server responds 'NW-members "neighborhhod watch" invalid e-mail address because not of form user@host.'

    I upgraded to Thunderbird 31.1.0 yesterday. I have not modified the distribution list in the last few weeks. This is the first time I have used the distribution list since the upgrade. I have never received an error message from the mail server objecting to my distribution list. The distribution list has thirty three (33) addresses. The last time I sent email using the distribution list was 8/28/14. Text of 'Invalid Recipient Address' alert box is "NW-members <"neighborhhod watch"> is not a valid e-mail address because it is not of the form user@host. You must correct it before sending the e-mail."
    ''(I've edited the question details and moved the thread to Thunderbird - c)''

    I am glad to hear that your problem has been resolved. I noticed you chose your own answer as the solution, can you select the answer that solved the problem. This will help other users with similar problems find the solution more easily.
    I also have new information about this.
    It looks like it's [https://bugzilla.mozilla.org/show_bug.cgi?id=1060901 this bug]. If you have an account on Bugzilla, it would help to vote for that issue.
    It seems lists with a description that includes several words have this problem. The bug report suggests replacing the blanks " " between the words in such lists' descriptions with an underscore "_".
    If you don't want to change your descriptions, [https://support.mozilla.org/en-US/questions/1018299#answer-623437 the other workaround provided] still works.

  • Not able to get the alerts in CCMS to distribution lists.

    Hi All,
    I have created the distribution lists -
    >Create Auto reaction Method ->Assigned the distribution list is added in the Parameters
    SENDER                 DDIC
    RECIPIENT              CCMS_2
    RECIPIENT-TYPEID       C
    REACT_ON_ALERTS        RED
    SUBJECT_ALERT          $SID: RED Alert for System $NODENAME  ,
    SUBJECT_ALERT_CONT     $NODENAME
    TIME_ZONE              EST
    and Assigned to auto reactions method But there alert are not generated to CCMS_2 distribution lists.
    Regards,
    Neni

    Hi Jagadish.
    Have you maintained an Email id for the user DDIC in SU01?
    Where do we need to add ?(I need alerts for  2 Email ids )
    Have you checked whether you are able to send mail to distribution list directly from SBWP?
    how can i test this?
    Regards,
    Swaroop

  • Setting Up A Contact Distribution List of Family Members for Text Messaging

    Friends,
    Is it possible to set up a distribution list of my family contacts?  I have several brothers and sisters and would like to send the same text message to all of them at once.  Can I key all of their phone numbers into one heading such as "family" and then use that as my "phone" number in the TO field?
    Please let me know if this is possible and if so, how do I do it?
    Thanks for your help.
    Doug Talbott Jr.

    You can send to multiple people but you can not save them as a group in the stock app but there is a number of apps on market that can do this.Try
    Handcent
    http://www.handcent.com/
    TextPlus
    https://market.android.com/details?id=com.gogii.textplus&feature=search_result
    Also check here...
    http://www.androidzoom.com/android_applications/send+group+sms

Maybe you are looking for