{"id":33,"date":"2013-05-22T15:34:22","date_gmt":"2013-05-22T15:34:22","guid":{"rendered":"http:\/\/www.edrockwell.com\/blog\/?p=33"},"modified":"2026-07-02T16:57:33","modified_gmt":"2026-07-02T16:57:33","slug":"script-to-get-a-distribution-list-membership-easily","status":"publish","type":"post","link":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/","title":{"rendered":"Script to get a distribution list membership easily"},"content":{"rendered":"<p>Throughout my years as a System Administrator, I&#8217;ve been asked\u00a0repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs.<\/p>\n<pre lang=\"POWERSHELL\">\r\n# Gets distribution list members from a group in exchange\r\n# Author: Ed Rockwell\r\n# Company: Some Company You Work At\r\n# Date: Today :)\r\n# Ver: 1.0\r\n\r\nparam (\r\n\t$OutputFile = \"C:\\listmembers.txt\"\r\n\t)\r\n\r\nWrite-Host \"Checking if output file already exists...\" -NoNewline\r\n\r\nif (Test-Path $OutputFile)\r\n\t{\r\n\t\tWrite-Host \"Found old output file from last run!\"\r\n\t\tWrite-Host \"Removing old output file...\" -NoNewline\r\n\t\tRemove-Item $OutputFile -Force\r\n\t\tWrite-Host \"Done!\"\r\n\t}\r\nelse\r\n\t{\r\n\t\tWrite-Host \"Cleanup of last output file not found... Good!\"\r\n\t}\r\n\r\nIF ( -NOT ( Get-PSSnapin -Name \"Microsoft.Exchange.Management.PowerShell.E2010\" -ErrorAction SilentlyContinue )) { Add-PSSnapin \"Microsoft.Exchange.Management.PowerShell.E2010\" }\r\n\r\n$UserCredential = Get-Credential \"Domain\\User\"\r\n$saveto = \"C:\\listmembers.txt\"\r\n$UserEntryGroupName = Read-Host \"Enter the Group you would like to get the members\"\r\n\r\nGet-DistributionGroup -identity \"$UserEntryGroupName\" | sort name | ForEach-Object {\r\n\t\t\"`r`n$($_.Name)`r`n=============\" | Add-Content $saveto\r\n\t\tGet-DistributionGroupMember $_.Name | sort Name | ForEach-Object {\r\n\t\t\t\t\t$_.Name + \" <\" + $_.PrimarySMTPAddress + \">\" | Add-Content $saveto\r\n\t\t\t\t}\r\n\t\t}\r\n\r\nNotepad c:\\listmembers.txt\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Throughout my years as a System Administrator, I&#8217;ve been asked\u00a0repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,16],"tags":[22,63,23,21,14],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-exchange","category-powershell","tag-distribution-list","tag-exchange","tag-membership","tag-powershell-2","tag-script"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Throughout my years as a System Administrator, I&#039;ve been asked repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Ed Rockwell\"\/>\n\t<meta name=\"keywords\" content=\"distribution list,exchange,membership,powershell,script\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"System Admin [RESOLVED] | How To: Make My DevOps Life Easier\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Script to get a distribution list membership easily | System Admin [RESOLVED]\" \/>\n\t\t<meta property=\"og:description\" content=\"Throughout my years as a System Administrator, I&#039;ve been asked repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2013-05-22T15:34:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-07-02T16:57:33+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Script to get a distribution list membership easily | System Admin [RESOLVED]\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Throughout my years as a System Administrator, I&#039;ve been asked repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#article\",\"name\":\"Script to get a distribution list membership easily | System Admin [RESOLVED]\",\"headline\":\"Script to get a distribution list membership easily\",\"author\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#organization\"},\"datePublished\":\"2013-05-22T15:34:22+00:00\",\"dateModified\":\"2026-07-02T16:57:33+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#webpage\"},\"articleSection\":\"Exchange, PowerShell, Distribution List, Exchange, Membership, Powershell, script\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/category\\\/powershell\\\/#listItem\",\"name\":\"PowerShell\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/category\\\/powershell\\\/#listItem\",\"position\":2,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/category\\\/powershell\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#listItem\",\"name\":\"Script to get a distribution list membership easily\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#listItem\",\"position\":3,\"name\":\"Script to get a distribution list membership easily\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/category\\\/powershell\\\/#listItem\",\"name\":\"PowerShell\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#organization\",\"name\":\"System Admin [RESOLVED]\",\"description\":\"How To: Make My DevOps Life Easier\",\"url\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"Ed Rockwell\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Ed Rockwell\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#webpage\",\"url\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/\",\"name\":\"Script to get a distribution list membership easily | System Admin [RESOLVED]\",\"description\":\"Throughout my years as a System Administrator, I've been asked repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/script-to-get-a-distribution-list-membership-easily\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2013-05-22T15:34:22+00:00\",\"dateModified\":\"2026-07-02T16:57:33+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/\",\"name\":\"System Admin [RESOLVED]\",\"description\":\"How To: Make My DevOps Life Easier\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.edrockwell.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Script to get a distribution list membership easily | System Admin [RESOLVED]","description":"Throughout my years as a System Administrator, I've been asked repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell","canonical_url":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/","robots":"max-image-preview:large","keywords":"distribution list,exchange,membership,powershell,script","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#article","name":"Script to get a distribution list membership easily | System Admin [RESOLVED]","headline":"Script to get a distribution list membership easily","author":{"@id":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/www.edrockwell.com\/blog\/#organization"},"datePublished":"2013-05-22T15:34:22+00:00","dateModified":"2026-07-02T16:57:33+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#webpage"},"isPartOf":{"@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#webpage"},"articleSection":"Exchange, PowerShell, Distribution List, Exchange, Membership, Powershell, script"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.edrockwell.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/category\/powershell\/#listItem","name":"PowerShell"}},{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/category\/powershell\/#listItem","position":2,"name":"PowerShell","item":"https:\/\/www.edrockwell.com\/blog\/category\/powershell\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#listItem","name":"Script to get a distribution list membership easily"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#listItem","position":3,"name":"Script to get a distribution list membership easily","previousItem":{"@type":"ListItem","@id":"https:\/\/www.edrockwell.com\/blog\/category\/powershell\/#listItem","name":"PowerShell"}}]},{"@type":"Organization","@id":"https:\/\/www.edrockwell.com\/blog\/#organization","name":"System Admin [RESOLVED]","description":"How To: Make My DevOps Life Easier","url":"https:\/\/www.edrockwell.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/#author","url":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/","name":"Ed Rockwell","image":{"@type":"ImageObject","@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/dea3152d7acd78aa28d280207c33f7ec516731ece9a54249cbbbebcfffc341e0?s=96&d=mm&r=g","width":96,"height":96,"caption":"Ed Rockwell"}},{"@type":"WebPage","@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#webpage","url":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/","name":"Script to get a distribution list membership easily | System Admin [RESOLVED]","description":"Throughout my years as a System Administrator, I've been asked repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.edrockwell.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/#breadcrumblist"},"author":{"@id":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/www.edrockwell.com\/blog\/author\/admin\/#author"},"datePublished":"2013-05-22T15:34:22+00:00","dateModified":"2026-07-02T16:57:33+00:00"},{"@type":"WebSite","@id":"https:\/\/www.edrockwell.com\/blog\/#website","url":"https:\/\/www.edrockwell.com\/blog\/","name":"System Admin [RESOLVED]","description":"How To: Make My DevOps Life Easier","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.edrockwell.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"System Admin [RESOLVED] | How To: Make My DevOps Life Easier","og:type":"article","og:title":"Script to get a distribution list membership easily | System Admin [RESOLVED]","og:description":"Throughout my years as a System Administrator, I've been asked repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell","og:url":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/","article:published_time":"2013-05-22T15:34:22+00:00","article:modified_time":"2026-07-02T16:57:33+00:00","twitter:card":"summary","twitter:title":"Script to get a distribution list membership easily | System Admin [RESOLVED]","twitter:description":"Throughout my years as a System Administrator, I've been asked repeatedly to produce a list for someone of the contents of a distribution list. I searched and found some scripts out there and ended up modifying one that now fits my needs. # Gets distribution list members from a group in exchange # Author: Ed Rockwell"},"aioseo_meta_data":{"post_id":"33","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-03-15 23:07:13","updated":"2026-07-02 17:24:20","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.edrockwell.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.edrockwell.com\/blog\/category\/powershell\/\" title=\"PowerShell\">PowerShell<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tScript to get a distribution list membership easily\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.edrockwell.com\/blog"},{"label":"PowerShell","link":"https:\/\/www.edrockwell.com\/blog\/category\/powershell\/"},{"label":"Script to get a distribution list membership easily","link":"https:\/\/www.edrockwell.com\/blog\/script-to-get-a-distribution-list-membership-easily\/"}],"_links":{"self":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":6,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":277,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/posts\/33\/revisions\/277"}],"wp:attachment":[{"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edrockwell.com\/blog\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}