Wednesday, May 2, 2012

Powershell and Active Directory: Find all distribution groups in AD with their Email-ID along with the date of creation using Powershell.



Today i got task from my IT Manager to create a list of all distribution group in our AD along with there Email-Id's also he required the date of creations of those distribution groups.

I thought lets try this with PowerShell. I was planning to use Get-ADGroup cmdlet to fulfil my purpose. This cmdlet only available if you have  "RSAT" installed on you laptop.

Lets Start.

Import the Active Directory module first.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

After importing the Module, we are going to use Get-ADGroup cmdlet.

To view all the group n your Active Directory we can use below command. This will show all the Groups.

Get-ADGroup -Filter *

02-05-2012 15-06-02

Lets filter the output and choose to view only "Distribution Groups"

Get-ADGroup -Filter 'GroupCategory -eq "Distribution"'

So we have the the list of distribution Groups. but our purpose is still not resolved. now we need Mail and Date of creation of these Groups.

02-05-2012 15-11-10

To view the mail, creation date we need to add -Properties *  to the  Get-ADGroup cmdlet.

Get-ADGroup -Filter 'GroupCategory -eq "Distribution"' -Properties * | select Name,mail,whenCreated | ft -AutoSize

02-05-2012 15-25-28 

All Sorted, our purpose is fulfil. If required we can also export the out to .CSV or .TXT format.

I Hope that it helps someone.


Aman Dhally



  1. This is great! Any idea how I can figure out which groups are inactive (i.e. not receiving emails for mare than xx days)? Thanks!



    1. Hi Aubrey, thanks for the nice comments,,and i think for your query we may need to use Exchnage Cmdlets .. and currently i am not working on Exchange so can't help you .. But logic is same you can try that.... :) ..

      aman dhally

  2. is there any way i can get all the Dist groups with their members list?
    i want to use get-adgroup and get-adgroupmember for that purpose
    Also need to get the list from a particular OU only


  3. I would like to ask, did you find a way?

  4. This comment has been removed by the author.