Active Directory · PowerShell

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

 

Hi,

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-ADGroupFilter *

02-05-2012 15-06-02

Lets filter the output and choose to view only “Distribution Groups”

Get-ADGroupFilter ‘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-ADGroupFilter ‘GroupCategory -eq “Distribution”‘ –Properties * | select Name,mail,whenCreated | ftAutoSize

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.

Thanks

Aman Dhally

spiderlove02

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

  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!

    Cheers,

    Aubrey

    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…. 🙂 ..

      thanks
      aman dhally

Comments are closed.