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
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!
ReplyDeleteCheers,
Aubrey
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.... :) ..
Deletethanks
aman dhally
is there any way i can get all the Dist groups with their members list?
ReplyDeletei want to use get-adgroup and get-adgroupmember for that purpose
Also need to get the list from a particular OU only
thanks
Sidhin
I would like to ask, did you find a way?
ReplyDelete