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