# How do I count the # of properties returned from a Get-?

**URL:** <https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823>\
**Category:** PowerShell Help\
**Created:** [June 13, 2017, 3:01pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823 "2017-06-13T15:01:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [June 13, 2017, 3:01pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823/1 "2017-06-13T15:01:52Z")

</div>

I ran this:

```
Get-ADObject -Filter {name -like ‘Unique_Bob’} -Properties * -Server[domain.com](http://domain.com)| measure
```

…but actually wanted to count the total of all properties returned (not just the number of _users_ named “bob”).

How could I quickly accomplish this?

thanks

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [June 13, 2017, 3:10pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823/2 "2017-06-13T15:10:35Z")

</div>

Pipe to Get-Member, and then pipe that output to Where-Object to filter for only those members which are properties, and pipe that to Measure-Object.

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [June 13, 2017, 4:41pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823/3 "2017-06-13T16:41:54Z")

</div>

Thanks Don

```
Get-ADObject -Filter {name -like 'Unique_Bob'} -Properties * -Server domain.com | gm | Where-Object MemberType -EQ Property | measure
```

How do I do that trick where I just get the “count”?

Tried this:

```
Get-ADObject -Filter {name -like ‘Unique_Bob’} -Properties * -Server[domain.com](http://domain.com)| gm | Where-Object MemberType -EQ Property |**(measure).count**
```
 and went down in flames.

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [June 13, 2017, 4:43pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823/4 "2017-06-13T16:43:33Z")

</div>

Yeah, that’s because you’re executing Measure as a single command with no input. That’s what parentheses do. You’re trying to copy something you’ve seen in other contexts ;).

Just add “| Select-Object Count” to the end if you only want to see the Count property.

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [June 13, 2017, 4:50pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823/5 "2017-06-13T16:50:01Z")

</div>

hmm I see this:

```
... gm | Where-Object MemberType -EQ Property | Select-Object count

count
-----
```

(lots of empty space but no "measured’ _count_ of the Property’s)

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [June 13, 2017, 5:35pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823/6 "2017-06-13T17:35:20Z")

</div>

Well, you deleted Measure-Object, dude. That’s what generates an object with the Count property.

Where, then Measure, then Select.

---

<div class="post-metadata">

**Author:** ![jeff-taylor](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/jeff-taylor/32/1015_2.png) [@jeff-taylor](https://forums.powershell.org/u/jeff-taylor)\
**Post date:** [June 14, 2017, 3:20pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823/7 "2017-06-14T15:20:43Z")

</div>

ah, Check… Thank ya kindly.

---

<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:38pm UTC](https://forums.powershell.org/t/how-do-i-count-the-of-properties-returned-from-a-get/8823/8 "2024-05-16T20:38:34Z")

</div>


