Abdulaziz asks on Twitter:
How I can get all the distribution lists “managed by” a particular user?
With PowerShell of course 🙂
Let’s take a closer look. Using Get-DistributionGroup we can see that distribution groups have a ManagedBy property.
[PS] C:>Get-DistributionGroup | fl name,managedby Name : Public Folder Owners ManagedBy : {} Name : Payroll Team ManagedBy : {exchangeserverpro.net/Users/Administrator} Name : Head Office Staff ManagedBy : {exchangeserverpro.net/Company/Head Office/Users/Alan.Reid, exchangeserverpro.net/Company/Head Office/Users /Alannah.Shaw} Name : All Staff ManagedBy : {exchangeserverpro.net/Company/Head Office/Users/Alan.Reid} Name : Branch Office Staff ManagedBy : {} Name : All Office Meeting Rooms ManagedBy : {exchangeserverpro.net/Users/Administrator}
So let’s say we want to find all of the distribution groups managed by Alan Reid. We can see two of them in the list above, so we’re expecting two results.
The fastest method in larger organizations would be to use Get-DistributionGroup with server-side filtering.
[PS] C:>Get-DistributionGroup -Filter {ManagedBy -eq "exchangeserverpro.net/Company/Head Office/Users/Alan.Reid"} Name DisplayName GroupType PrimarySmtpAddress ---- ----------- --------- ------------------ All Staff All Staff Universal AllStaff@exchangeserverpro... Head Office Staff Head Office Staff Universal HeadOfficeStaff@exchangese...
However, the downside (if you can call it that) is that you need to type out the full “identity” of the user you want to search on, eg “exchangeserverpro.net/Company/Head Office/Users/Alan.Reid”.
So if you prefer, you can use client-side filtering (via Where-Object with the -like operator and a wildcard) instead.
[PS] C:>Get-DistributionGroup | where {$_.ManagedBy -like "*Alan.Reid"} Name DisplayName GroupType PrimarySmtpAddress ---- ----------- --------- ------------------ All Staff All Staff Universal AllStaff@exchangeserverpro... Head Office Staff Head Office Staff Universal HeadOfficeStaff@exchangese...
This command worked for me in office 365
Get-DistributionGroup -ManagedBy ‘useremail’
How can you get list of Owner less groups also over 1000 groups available.
Thank you
How can i get a list of all distribution list a user is member of across multiple child domains.
Help! I know that I can extract distribution list membership using PowerShell, but how do I extract the distribution groups of which a single mailbox is a member? Basically want to know what commands will let me get the distribution group membership for a specific user.
Is this possible? I’ve been looking around and I think I can manage it with a filter, but I’m not sure how to get it done. Any help would be great!
I don’t think you can do it server-side with a filter as Get-DistributionGroupMember isn’t filterable but the below script will do it client-side using Where-Object clause although it’s quite slow as it has to retrieve every DG and scan each one for the user
$User = read-host -Prompt “Enter Username”
“User ” + $User + ” is a member of the following groups:”
ForEach ($Group in Get-DistributionGroup)
{
ForEach ($Member in Get-DistributionGroupMember -identity $Group.Identity | Where { $_.Name –eq $User })
{
$Group.name
}
}
Pingback: markwilson.it » Short takes: hosts files; C#; Azure VMs; sleuthing around Exchange; closing Windows 8 apps; and managing tabs in Google Chrome
This is great for an audit I’m trying to run. How can I get this to run with txt file of 300 users and export 1 report?
hi,
I have to audit the Distribution groups which was created in last one week, and report would be emails to me with basic details of Distributing groups. please share your experience on this
I am using Exchange 2010 SP2 RU4. Is there a way to export the “managed by” values of a DL in SMTP or logonid instead of the contoso.com/Users/username format?
Just wondering if you have found a solution to this. I am fighting this exact problem. I am trying to write a script that will email the managers of each distribution group and I am unable to pull the username/email from what returns from the managedBy property.
Oh almost forgot , this is for a Exchange 2007 environment.
Hi , is there a way to export the last date that distribution lists received emails? I need to export all the distribution lists in our organization , but needs to contain when last the DL’s received email.
Not by quering the DL itself, but you could find the info in message tracking logs.
Really thanks for your usual help, it is useful
Any ideas on how we get inactive distro groups into a PowerSell generated report? By inactive I mean that they have not been receiving emails for XX # of days. Thanks in advance!
Cheers,
Aubrey