Exporting Distribution List Details
Let’s assume that you have a large organization with a ‘N’ number of Distribution Groups. You or one of your manager wants to know who is managing which Distribution Groups, who can able to send mails to the DL’s, who are the members of the DL and other details.
You can do this with several many ways. But I will show you how you can achieve this in few simple Cmdlets easily in my way.
Note: Instead of simply giving you the Cmdlet to export or list out the details, I am showing you how you can figure out yourself to resolve similar issue or export the lists. If you already familiar with the PowerShell, please scroll down to the end of the page to see the final Cmdlet to export the list.
Now, let’s get all the Distribution lists in a Variable called Distribution Groups.
$DistributionGroups = Get-DistributionGroup -ResultSize Unlimited
You can see all the information stored in the variable by entering $DistributionGroups.
If you just want to know how many DL’s you have in the memory/stored in the variable, you can do
$DistributionGroups.Count
Now, Lets Export the details which we want. Here, I am Exporting the Group Name, Group Email Address, who manages the Group / Group Manager, who can send mails to the Security restricted groups, Group Members, Group Member samAccountName.
$DG = foreach ($group in (Get-DistributionGroup -Filter {name -like "*"})) {Get-DistributionGroupMember $group | Ft @{Label="Group";Expression={$Group.Name}},@{Label="Group Mail Address";Expression={$Group.PrimarySMTPAddress}},@{Label="Group Owner";Expression={$Group.ManagedBy}},@{Label="Allowed Senders";Expression={$Group.AcceptMessagesOnlyFrom}},@{Label="Member";Expression={$_.Name}},SamAccountName}
Now, Let’s Export the output to a CSV file.
$DG | Export-Csv “./DistributionGroupDetails.Csv”
The Above Cmdlet will save the .Csv file in the current directory from where you are running the PowerShell. As shown in the screenshot above, my current path on PowerShell is “C:\Windows\System32”. Hence the File will be created inside the “C:\Windows\System32\” folder
Hi,
Nice and useful website, Thanks for providing the information.
Aras
You are a really persuasive writer. I can see this in your writeup. You’ve a way of writing compelling info that sparks significantly interest.
I really enjoy the blog post. Great.
let me know if you face any difficulties in this. i will try to help
This piece of writing will assist the internet viewers for creating new weblog or even a blog from start to end.
Everything is very open with a really clear description of the
challenges. It was really informative. Your website is very
useful. Thanks for sharing!
Hi there! This blog post couldn’t be written much better!
Looking through this article reminds me of my previous roommate!
He always kept talking about this. I most certainly
will forward this post to him. Pretty sure he’s going to have a
good read. Many thanks for sharing!
Thanks for sharing your thoughts. I really appreciate your efforts and I will be waiting for your
further write ups thank you once again.
This excellent website really has all the information I needed concerning this subject and didn’t
know who to ask.
Hello there! Would you mind if I share your blog with my facebook group?
There’s a lot of people that I think would really appreciate your content.
Please let me know. Thanks
Sure. You can share it
That is a very good tip especially to those fresh to the blogosphere.
Brief but very precise info… Appreciate your sharing this one.
A must read post!
My partner and I stumbled over here from a different website
and thought I might check things out. I like what I see
so i am just following you. Look forward to looking at your
web page yet again.
It is truly a great and helpful piece of info.
I’m happy that you shared this helpful information with us.
Please stay us up to date like this. Thanks for sharing.
It’s impressive that you are getting thoughts from this piece of writing as well as from our argument made here.
Hello There. I discovered your blog the use of msn. This is a really well written article.
I will be sure to bookmark it and come back to read extra of your helpful information. Thank you for the post.
I will definitely comeback.
Greetings from Carolina! I’m bored to death at
work so I decided to browse your website on my iphone
during lunch break. I really like the info you present here and can’t wait to take a look when I get
home. I’m shocked at how fast your blog loaded on my mobile ..
I’m not even using WIFI, just 3G .. Anyways, awesome site!
Hello! Do you use Twitter? I’d like to follow you if
that would be ok. I’m absolutely enjoying your blog and look
forward to new posts.
Keep on working, great job!
Hi, I do think this is an excellent site. I stumbledupon it 😉 I
am going to return once again since i have book-marked it.
Money and freedom is the greatest way to change, may you be rich and continue to help
others.