{"id":4896,"date":"2018-11-26T17:00:27","date_gmt":"2018-11-26T16:00:27","guid":{"rendered":"https:\/\/www.razumny.no\/?p=4896"},"modified":"2021-01-26T17:54:23","modified_gmt":"2021-01-26T16:54:23","slug":"exporting-ad-group-members-display-name","status":"publish","type":"post","link":"https:\/\/www.razumny.no\/?p=4896","title":{"rendered":"Exporting AD group members&#8217; display name"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.razumny.no\/?p=2197\">Five years ago<\/a>, I showed you how to export a list of members of an Active Directory group, using a command line query. One issue I&#8217;ve run into using this query, is that I get their user name, not their actual name, which tends to make the resulting list hard to parse. As I had a need to export a relatively large number of group members names as part of a recent ticket, I needed a solution that gave me what I wanted straight out of the box.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While you might be able to achieve what you want with a command line query, PowerShell has come to stay, and gives a lot more options, so that&#8217;s the format I opted for. The query is built from three sections. First, you need to get the members of the group, then you need to extract their display name, and finally, you need to filter out everything\u00a0<em>but<\/em> the displayname. The three sections look something like this:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Get-ADGroupMember -identity &#8220;GROUPNAME&#8221;<\/li><li>Get-ADUser -property Displayname<\/li><li>select Displayname<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I then added the option to export it as a .txt format list, piping each command into the next. As a result, my final command looked like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Get-ADGroupMember -identity \"GROUPNAME\" | GetADUser -property Displayname | select Displayname > filename.txt<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Five years ago, I showed you how to export a list of members of an Active Directory group, using a command line query. One issue I&#8217;ve run into using this query, is that I get their user name, not their actual name, which tends to make the resulting list hard to parse. As I had [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[615,677,528],"tags":[760,969],"class_list":["post-4896","post","type-post","status-publish","format-standard","hentry","category-how-to-2","category-tips-tricks","category-tools","tag-active-directory","tag-powershell"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p2ukSU-1gY","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2419,"url":"https:\/\/www.razumny.no\/?p=2419","url_meta":{"origin":4896,"position":0},"title":"Exporting a list of a given users group memberships from Active Directory","author":"Aleksander Nordgarden-R\u00f8dner","date":"05\/05\/2014","format":false,"excerpt":"A while back, I showed you how to export a list of all members of a group, as well as all computers, from Active Directory. On a related note, here's how to export all group memberships held by a single user: Log on to your Domain Controller Open a command\u2026","rel":"","context":"In &quot;code examples&quot;","block_context":{"text":"code examples","link":"https:\/\/www.razumny.no\/?cat=119"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5265,"url":"https:\/\/www.razumny.no\/?p=5265","url_meta":{"origin":4896,"position":1},"title":"Building a script to find all members of a given group","author":"Aleksander Nordgarden-R\u00f8dner","date":"09\/09\/2019","format":false,"excerpt":"Some time ago, I was asked to provide a list of everyone with access to a specific system. After communicating with the client, it transpired that they were particularly interested in knowing who were the members of a set of Active Directory groups. While this can be done manually, I\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5446,"url":"https:\/\/www.razumny.no\/?p=5446","url_meta":{"origin":4896,"position":2},"title":"Powershell: Retrieving all properties for a given user object","author":"Aleksander Nordgarden-R\u00f8dner","date":"20\/04\/2020","format":false,"excerpt":"I was asked to provide an overview of all available properties in an Active Directory user object for an upcoming project. As it turns out, that is very easily accomplished. Unsurprisingly, PowerShell has an applet for this. We use the Get-ADUser applet, with the parameters Identity to identify the user\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"Output of get-aduser command, filtering on identity and specific proeprties","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":6303,"url":"https:\/\/www.razumny.no\/?p=6303","url_meta":{"origin":4896,"position":3},"title":"Finding all groups without a manager in a specific OU in AD","author":"Aleksander Nordgarden-R\u00f8dner","date":"01\/03\/2021","format":false,"excerpt":"Last week, I showed you how you can easily find the OU to use when looking for the members of a specific OU. Today, I'd like to show you how I use that information. The background was that we use AD groups to control access to network shares. In order\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-47.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4297,"url":"https:\/\/www.razumny.no\/?p=4297","url_meta":{"origin":4896,"position":4},"title":"Powershell: Exporting Active Directory Contacts","author":"Aleksander Nordgarden-R\u00f8dner","date":"16\/10\/2017","format":false,"excerpt":"Some time ago, I needed to have a list of all Contacts registered in Active Directory. Knowing that there are a lot of them (numbering at least eighty), getting the data manually was not a viable alternative, particularly knowing that the same objective can be achieved through Powershell. I eventually\u2026","rel":"","context":"In &quot;code examples&quot;","block_context":{"text":"code examples","link":"https:\/\/www.razumny.no\/?cat=119"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5402,"url":"https:\/\/www.razumny.no\/?p=5402","url_meta":{"origin":4896,"position":5},"title":"PowerShell: Count enabled user accounts","author":"Aleksander Nordgarden-R\u00f8dner","date":"16\/03\/2020","format":false,"excerpt":"A few weeks ago, I showed you how to get a list of all enabled user accounts in PowerShell. Perhaps unsurprisingly, after having presented this to my customer, it transpired that what they really wanted, was to know how many enabled user accounts existed in Active Directory. Once more, my\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/4896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4896"}],"version-history":[{"count":3,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/4896\/revisions"}],"predecessor-version":[{"id":6249,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/4896\/revisions\/6249"}],"wp:attachment":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}