{"id":51,"date":"2015-05-14T01:16:00","date_gmt":"2015-05-14T01:16:00","guid":{"rendered":"http:\/\/geekmungus.co.uk\/?p=51"},"modified":"2022-11-05T10:53:19","modified_gmt":"2022-11-05T10:53:19","slug":"getting-a-specific-attribute-about-each-ad-user-using-powershell","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=51","title":{"rendered":"Getting a specific attribute about each AD User using PowerShell"},"content":{"rendered":"\n<p>Using powershell you can get the value of a specific attribute of a user. To do this run the below, this will get all the user objects in the OU called &#8220;Users&#8221; and display the samAccountName and extensionAttribute10 attribute.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$users = Get-ADUser -Filter * -SearchScope Subtree -SearchBase \"OU=Users,DC=domain,DC=co,DC=uk\" | Select-Object DistinguishedName, SamAccountName\nforeach ($i in $users)\n{\n$id = $i.DistinguishedName\n$extattrib2 = Get-ADUser -Identity $id -Properties extensionAttribute10 | select-object -ExpandProperty extensionAttribute10\nWrite-Host $i.SamAccountName,\"-\",$extattrib2\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Using powershell you can get the value of a specific attribute of a user. To do this run the below, this will get all the user objects in the OU called &#8220;Users&#8221; and display the samAccountName and extensionAttribute10 attribute.<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,14],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-active-directory","category-microsoft-windows"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=51"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":1440,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions\/1440"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}