locked
Powershell cmdlet or script to get a list of all users in DL and Nested DL's users RRS feed

  • Question

  • Hi , does anyone know hot to get a list of all the users in a DL along with Nested DLs members/users.

    Suppose there is a DL called - Parent DL which includes users 1, 2, 3, 4 and Chlid DL under Parent DL which includes users A, B ,C so i want a list of all the users which belongs to parent DL and Child DL(nested one) so does anyone know the cmdlet or some script to get that .. pls help thanks 

    Tuesday, June 25, 2013 11:46 AM

Answers

  • Hi

    check this article it's about users in nested groups

    Get distribution group all members – nested

    run powershell console

    Import-Module ActiveDirectory 

    Get-ADGroupMember ParentGroup -recursive | select Name

    if you want to get only enabled users then use:

    Get-ADGroupMember ParentGroup -recursive | % {Get-ADUser $_ -properties enabled | ? {$_.enabled -eq $True} | select Name}


    Remigiusz
    ExchangeBlog

    • Marked as answer by Jugalkumar Tuesday, June 25, 2013 4:37 PM
    Tuesday, June 25, 2013 2:06 PM
  • Hi you need to use:

    Get-ADGroupMember ParentGroup -recursive | % {Get-ADUser $_ -properties * | ? {$_.enabled -eq $True} | select Name,City} 


    Remigiusz
    ExchangeBlog

    • Marked as answer by Jugalkumar Thursday, June 27, 2013 5:36 PM
    Wednesday, June 26, 2013 7:19 PM

All replies

  • Hi

    check this article it's about users in nested groups

    Get distribution group all members – nested

    run powershell console

    Import-Module ActiveDirectory 

    Get-ADGroupMember ParentGroup -recursive | select Name

    if you want to get only enabled users then use:

    Get-ADGroupMember ParentGroup -recursive | % {Get-ADUser $_ -properties enabled | ? {$_.enabled -eq $True} | select Name}


    Remigiusz
    ExchangeBlog

    • Marked as answer by Jugalkumar Tuesday, June 25, 2013 4:37 PM
    Tuesday, June 25, 2013 2:06 PM
  • hello , i want more details like user belongs to which city or location some thing like that even i tried with below cmd while adding the city or location but it does not work anymore? any suggestion pls 

    Get-ADGroupMember ParentGroup -recursive | % {Get-ADUser $_ -properties enabled | ? {$_.enabled -eq $True} | select Name,City} 

    Actually i am looking for user belongs to which exchange database, there is an AD attribute called "HomeMDB" but when i tried with that i did not get any things ? any help will be gr8 thanks 

    • Edited by Jugalkumar Wednesday, June 26, 2013 2:12 PM more info
    Wednesday, June 26, 2013 1:20 PM
  • Hi you need to use:

    Get-ADGroupMember ParentGroup -recursive | % {Get-ADUser $_ -properties * | ? {$_.enabled -eq $True} | select Name,City} 


    Remigiusz
    ExchangeBlog

    • Marked as answer by Jugalkumar Thursday, June 27, 2013 5:36 PM
    Wednesday, June 26, 2013 7:19 PM
  • Kool Thanks 
    Thursday, June 27, 2013 5:36 PM