{"id":5446,"date":"2020-04-20T17:00:00","date_gmt":"2020-04-20T15:00:00","guid":{"rendered":"https:\/\/www.razumny.no\/?p=5446"},"modified":"2020-04-29T14:13:14","modified_gmt":"2020-04-29T12:13:14","slug":"powershell-retrieving-all-properties-for-a-given-user-object","status":"publish","type":"post","link":"https:\/\/www.razumny.no\/?p=5446","title":{"rendered":"Powershell: Retrieving all properties for a given user object"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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 <code>Get-ADUser<\/code> applet, with the parameters <code>Identity<\/code> to identify the user in question and <code>Properties<\/code> with a wildcard to return all properties.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The query looks something like this: <code>Get-ADUser -Filter %USER% -Properties *<\/code>, and it will return each and every property. There are a lot of them, and it turned out that they only really wanted a few; user name, display name, company, department, last logon date, and manager.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Removing the wildcard, and adding the specific properties they were looking for, the query looked like this:  <code>Get-ADUser -Filter %USER% -Properties CN, DisplayName, Company, Department, LastLogonDate, Manager<\/code>. By default, PowerShell returns a few other properties too, meaning that the result of the query looked like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"801\" height=\"281\" src=\"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=801%2C281&#038;ssl=1\" alt=\"Output of get-aduser command, filtering on identity and specific properties\" class=\"wp-image-5447\" title=\"Output of get-aduser command, filtering on identity and specific properties\" srcset=\"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?w=801&amp;ssl=1 801w, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=300%2C105&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-13.png?resize=768%2C269&amp;ssl=1 768w\" sizes=\"auto, (max-width: 801px) 100vw, 801px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 in question and Properties with [&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":[820],"tags":[1187,969,1242],"class_list":["post-5446","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-get-aduser","tag-powershell","tag-properties"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p2ukSU-1pQ","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":5451,"url":"https:\/\/www.razumny.no\/?p=5451","url_meta":{"origin":5446,"position":0},"title":"PowerShell: Pipe output to CSV file","author":"Aleksander Nordgarden-R\u00f8dner","date":"11\/05\/2020","format":false,"excerpt":"Last week, I showed you how to get specific properties for all users in a given OU. Knowing that the output of that query quickly gets hard to navigate, wanting to remove the extraneous data that the customer didn't request, and assuming that they wanted to manipulate the data, I\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":[]},{"id":5450,"url":"https:\/\/www.razumny.no\/?p=5450","url_meta":{"origin":5446,"position":1},"title":"PowerShell: Getting properties for all user objects in a given OU","author":"Aleksander Nordgarden-R\u00f8dner","date":"04\/05\/2020","format":false,"excerpt":"Two weeks ago, I showed you how I got some specific properties for a specific user. Perhaps unsurprisingly, the next request from my customer was a similar dump from a specific OU. While the Identity parameter works well when you're dealing with a specific user, it doesn't help when you\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":[]},{"id":7000,"url":"https:\/\/www.razumny.no\/?p=7000","url_meta":{"origin":5446,"position":2},"title":"PowerShell: Return multiple specific properties","author":"Aleksander Nordgarden-R\u00f8dner","date":"12\/12\/2022","format":false,"excerpt":"The script I described a few weeks ago for finding all members of several groups is serving me very well indeed. I was recently asked to provide both the display name and the login name for each member in the group. This was readily achieved by modifying the script slightly.\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":7070,"url":"https:\/\/www.razumny.no\/?p=7070","url_meta":{"origin":5446,"position":3},"title":"PowerShell: Find User based on partial name","author":"Aleksander Nordgarden-R\u00f8dner","date":"06\/02\/2023","format":false,"excerpt":"Some time ago, I needed to look up the account names of a handful of users in Active Directory. The information I had beforehand was their names. I did not have ADUC available to me, but I did have PowerShell. This is an excellent use case for the Get-ADUser cmdlet\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"Get-ADUser : A positional parameter cannot be found that accepts argument 'Firstname Surname'.\nAt line:1 char:1\n+ Get-ADUser -Filter displayName \"Firstname Surname\"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n    + CategoryInfo          : InvalidArgument: (:) [Get-ADUser], ParameterBindingException\n    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.ActiveDirectory.Management.Commands.GetADUser","src":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-114.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-114.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-114.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-114.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7133,"url":"https:\/\/www.razumny.no\/?p=7133","url_meta":{"origin":5446,"position":4},"title":"PowerShell: Looking up specific user properties","author":"Aleksander Nordgarden-R\u00f8dner","date":"03\/04\/2023","format":false,"excerpt":"Many of my customers use specific properties for various things. Most users do not have ADUC installed, and some of our customers even disallow installation of ADUC on end user computers. I recently had a user ask about looking up the contents of a specific attribute (extensionAttribute6, in case you\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":7002,"url":"https:\/\/www.razumny.no\/?p=7002","url_meta":{"origin":5446,"position":5},"title":"PowerShell: Default properties","author":"Aleksander Nordgarden-R\u00f8dner","date":"19\/12\/2022","format":false,"excerpt":"Last week, when describing how to return specific properties, I mentioned that the command returns some standard properties, which is why I didn't have to specify that it should get the Displayname for the members of the group. What properties are by default returned for the commonly used commands? Get-ADComputerDistinguishedName,\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\/5446","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=5446"}],"version-history":[{"count":4,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/5446\/revisions"}],"predecessor-version":[{"id":5508,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/5446\/revisions\/5508"}],"wp:attachment":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}