# Get-ADObject to discover types?

**URL:** <https://forums.powershell.org/t/get-adobject-to-discover-types/15540>\
**Category:** PowerShell Help\
**Created:** [January 28, 2021, 6:30am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540 "2021-01-28T06:30:05Z")\
**Posts on this page:** 14\
**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:** [January 28, 2021, 6:30am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/1 "2021-01-28T06:30:05Z")

</div>

Is Get-ADObject the correct cmdlet to gather all the types of objects (i.e. Users, Groups, et al) in use in AD? I want an inventory of whatever we actually have objects active in AD

&nbsp;

thanks

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [January 28, 2021, 8:17am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/2 "2021-01-28T08:17:26Z")

</div>

Did you try it? Did it work?

---

<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:** [January 28, 2021, 10:10am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/3 "2021-01-28T10:10:56Z")

</div>

I tried this:

Sort -Unique didn’t work as I expected so here is the one line I tried

```
Get-ADObject -Filter * -Properties * | Select ObjectClass -First 10

ObjectClass              
-----------              
domainDNS                
organizationalUnit       
organizationalUnit       
organizationalUnit       
computer                 
msFVE-RecoveryInformation
msFVE-RecoveryInformation
computer                 
computer                 
msFVE-RecoveryInformation
```

---

<div class="post-metadata">

**Author:** ![rob-simmers](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/rob-simmers/32/1010_2.png) [@rob-simmers](https://forums.powershell.org/u/rob-simmers)\
**Post date:** [January 28, 2021, 10:14am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/4 "2021-01-28T10:14:27Z")

</div>

Try Group-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:** [January 28, 2021, 10:57am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/5 "2021-01-28T10:57:58Z")

</div>

```
Group-Object : Cannot compare "@{ObjectClass=domainDNS}" to "@{ObjectClass=organizationalUnit}" because the objects are not the same type or the object 
"@{ObjectClass=domainDNS}" does not implement "IComparable".
```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [January 28, 2021, 11:15am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/6 "2021-01-28T11:15:45Z")

</div>

How about this?

```
Get-ADObject -Filter * | Select-Object -Property ObjectClass -Unique
```

---

<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:** [January 28, 2021, 11:23am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/7 "2021-01-28T11:23:02Z")

</div>

Thank you Wow, that’s a lot of Classes (82). I want to know about the ones that actually have any values in them. Maybe that’ll uncover only the largest ones, I hope

Something like:

```
Get-ADObject -Filter * | Select-Object -Property ObjectClass -Unique | Where {$_.ObjectClass ???}
```

---

<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:** [January 28, 2021, 1:50pm UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/8 "2021-01-28T13:50:45Z")

</div>

Yes but there are a lot of returns there that we don’t use. How can I query for ObjectClass that actually have values/data?

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [January 28, 2021, 2:57pm UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/9 "2021-01-28T14:57:46Z")

</div>

> [@](#):
>
> Yes but there are a lot of returns there that we don’t use. How can I query for ObjectClass that actually have values/data?

You asked for this:

> [@](#):
>
> Is Get-ADObject the correct cmdlet to gather all the types of objects (i.e. Users, Groups, et al) in use in AD? I want an inventory of whatever we actually have objects active in AD

… gather **all** the types of objects …

What for do you actually need this information?

---

<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:** [January 29, 2021, 7:50am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/10 "2021-01-29T07:50:55Z")

</div>

Yes, thank you I didn’t realize that were that _many_ objects (count = 82). I’d like to winnow that down to only the (unique) objects/classes that actually have data or values in them.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [January 29, 2021, 9:09am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/11 "2021-01-29T09:09:57Z")

</div>

OK, and now just out of curiousity I’ll ask again: What for do you actually need this information?

Until now I couldn’t think of any benefit from this info.

---

<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:** [January 29, 2021, 9:37am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/12 "2021-01-29T09:37:30Z")

</div>

ah sure, we want to consider a re-org of our OU design and want to consider how its currently being provisioned for objects

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [January 29, 2021, 9:54am UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/13 "2021-01-29T09:54:57Z")

</div>

Hmmm … actually I’m even more confused now. 😉 Wouldn’t it bee better to have a kind of tree view of your OUs and elements in those OUs to have an overview?

And just to mention it at least once - The OU structure of your AD should not necessarily reflect the company structure. 😉

.

---

<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:27pm UTC](https://forums.powershell.org/t/get-adobject-to-discover-types/15540/14 "2024-05-16T20:27:58Z")

</div>


