Getting AD users in a group with PowerShell

PowerShell rocks, but a part of the rockiness comes from the great third party additions. For example, enumerating the users in an Active Directory Group is somewhat painful with the basic PowerShell… but throw in Quest Software’s excellent free ActiveRoles Management Shell extensions, and things get a lot smoother.

The goodness can be downloaded from http://www.quest.com/powershell/activeroles-server.aspx.

I needed to get email addresses of users in a group and its subgroups. Well, I power up the ActiveRoles Management Shell and type in:

Get-QADGroupMember MYDOMAIN\Finance -indirect | 
   where { $_.Type -eq 'user' } | 
   foreach { $_.Email }

And then, I just have what I need. Of course, had I needed something else, I would have had quite a great object structure available for navigation.

Thanks, Quest guys!

June 11, 2010 · Jouni Heikniemi · 4 Comments
Tags: ,  Â· Posted in: Windows IT

4 Responses

  1. Jaba - June 11, 2010

    Just for comparison, getting the similar list in LDIF format from OpenLDAP by using the command line tools:

    ldapsearch -LLL -x -b "ou=Finance,dc=mydomain,dc=com" "(user=*)" email

    Getting only the list of email addresses without additional output is a bit more awkward (unless there's a way I have missed…):

    ldapsearch -x -b "ou=Finance,dc=mydomain,dc=com" "(user=*)" email | grep email: | cut -d ':' -f2

  2. xxx porn movie - June 5, 2016

    I am sherrymi my pusy so tight, My hobbies sex with playboy http://guidemesupplements.com/

  3. remove-virusspyware - August 10, 2016

    There is certainly a lot to learn about this subject.
    I like all the points you have made.

  4. deletemylucky123comvirus.wordpress.com - October 25, 2016

    Are you currently encountering Federal Computer Criminal offense Unite virus?
    Every woman desires their skin to be smooth smooth and hair is
    among the biggest enemies. This particular computer users is prompted to set up this virus in a down load.

    internet explorer browser (deletemylucky123comvirus.wordpress.com)
    remove google redirect (deletemylucky123comvirus.wordpress.com)
    get rid of cleanup antivirus; deletemylucky123comvirus.wordpress.com,

Leave a Reply