# Count users attributes in AD

**URL:** <https://forums.powershell.org/t/count-users-attributes-in-ad/6810>\
**Category:** PowerShell Help\
**Created:** [July 13, 2016, 1:12pm UTC](https://forums.powershell.org/t/count-users-attributes-in-ad/6810 "2016-07-13T13:12:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexander-dubel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/alexander-dubel/32/278_2.png) [@alexander-dubel](https://forums.powershell.org/u/alexander-dubel)\
**Post date:** [July 13, 2016, 1:12pm UTC](https://forums.powershell.org/t/count-users-attributes-in-ad/6810/1 "2016-07-13T13:12:36Z")

</div>

Hello, guys  
I need to count how many user attributes we have in our Active directory.  
The command  
Get-ADUser -identity Administrator -properties \*  
gives me all information about attributes but I can’t calculate them.  
@(Get-ADUser -identity Administrator -properties \*).Count # returns 1  
@(Get-ADUser -identity Administrator -properties \*).Length # returns 1  
$output=Get-ADUser -identity Administrator -properties \*  
@($output).Count # returns 1  
Please help

---

<div class="post-metadata">

**Author:** ![dan-potter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/dan-potter/32/138_2.png) [@dan-potter](https://forums.powershell.org/u/dan-potter)\
**Post date:** [July 13, 2016, 1:26pm UTC](https://forums.powershell.org/t/count-users-attributes-in-ad/6810/2 "2016-07-13T13:26:43Z")

</div>

fyi, properties \* doesn’t contain all attributes.

---

<div class="post-metadata">

**Author:** ![dan-potter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/dan-potter/32/138_2.png) [@dan-potter](https://forums.powershell.org/u/dan-potter)\
**Post date:** [July 13, 2016, 1:28pm UTC](https://forums.powershell.org/t/count-users-attributes-in-ad/6810/3 "2016-07-13T13:28:31Z")

</div>

(get-aduser me -Properties \* |gm -MemberType property).count

---

<div class="post-metadata">

**Author:** ![matt-howard](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/matt-howard/32/247_2.png) [@matt-howard](https://forums.powershell.org/u/matt-howard)\
**Post date:** [July 13, 2016, 1:32pm UTC](https://forums.powershell.org/t/count-users-attributes-in-ad/6810/4 "2016-07-13T13:32:27Z")

</div>

Instead of .Count or .Length, use .PropertyCount

i.e: (Get-ADUser -Identity Administrator -Properties \*).PropertyCount

---

<div class="post-metadata">

**Author:** ![alexander-dubel](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/alexander-dubel/32/278_2.png) [@alexander-dubel](https://forums.powershell.org/u/alexander-dubel)\
**Post date:** [July 13, 2016, 1:43pm UTC](https://forums.powershell.org/t/count-users-attributes-in-ad/6810/5 "2016-07-13T13:43:20Z")

</div>

Thank you guys.  
Your answers were really fast!  
Both variants are working.

---

<div class="post-metadata">

**Author:** ![dan-potter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/dan-potter/32/138_2.png) [@dan-potter](https://forums.powershell.org/u/dan-potter)\
**Post date:** [July 13, 2016, 2:12pm UTC](https://forums.powershell.org/t/count-users-attributes-in-ad/6810/6 "2016-07-13T14:12:58Z")

</div>

Good one Matt. Hard to break old habits:D

Get-ADObject -filter \* -SearchBase (Get-ADRootDSE).schemaNamingContext | where objectclass -like “attributeschema” |select name

now figure out how you can find those only related to the user class:D

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:40pm UTC](https://forums.powershell.org/t/count-users-attributes-in-ad/6810/7 "2024-05-16T20:40:54Z")

</div>

Closed on May 16, 2024, 8:40pm UTC


