pramod1
asked on
Exchange office 365
I need to run command shell to find
Which distribution group is active like receiving emails and which groups are not as I need clean up distribution groups
Which distribution group is active like receiving emails and which groups are not as I need clean up distribution groups
There is no such cmdlet/report available in O365. Your best bet is to crawl the message trace logs and use the information there to check the "last used" date for a particular group. Here's a good script to use for that: https://gallery.technet.microsoft.com/office/Office-365-Mail-Traffic-afa37da1#content
ASKER
I am writing this:
$DistroLists = Get-Content M:\DistroList.txt
Foreach ($DistroList in $DistroLists) {
Get-MessageTrace -RecipientAddress $DistroList -Status expanded -StartDate 05/09/2017 -EndDate 06/08/2017 |Sort-Object RecipientAddress | Group-Object RecipientAddress |Sort-Object Name |Select-Object Name, Count | Export-CSV C:\Temp\ActiveDGs.csv -Append -NotypeInformation
}
but at the end it is giving >>}
$DistroLists = Get-Content M:\DistroList.txt
Foreach ($DistroList in $DistroLists) {
Get-MessageTrace -RecipientAddress $DistroList -Status expanded -StartDate 05/09/2017 -EndDate 06/08/2017 |Sort-Object RecipientAddress | Group-Object RecipientAddress |Sort-Object Name |Select-Object Name, Count | Export-CSV C:\Temp\ActiveDGs.csv -Append -NotypeInformation
}
but at the end it is giving >>}
A very good script! One minor detail to keep in mind that Get-MessageTrace used in this script goes only 48 hours back. To get older data, you will need to use Start-HistoricalSearch and then go through the returned data. To be honest this task would be much easier on-premises with Get-MessageTrackingLog.
ASKER
I am not sure which command to run here can above script be modified?
Simply use the script I linked to. And yes, the timespan (14 days, not 2) is a valid point. You can however store the results from running the script and continue adding new ones periodically to have a longer timespan available. Or of course check some of the third-party reporting products.
ASKER
Is the script addresses distribution group
ASKER
As I need to know only about distribution groups
ASKER
Do I need to run in exchange online?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That will be too much need to check dl only