AD Object Type

Welcome Forums General PowerShell Q&A AD Object Type

This topic contains 4 replies, has 2 voices, and was last updated by

 
Participant
1 year, 11 months ago.

  • Author
    Posts
  • #57731

    Participant
    Points: 0
    Rank: Member

    How can I find out if an object is a user or group?

    Say I do a get-acl and i see...

    domain\awellis
    domain\IT GROUP

    Is there a command to query AD to see that the first one's type is user and the 2nd one's is a group?

  • #57742

    Participant
    Points: 8
    Rank: Member

    Get-ADObject outputs among other stuff the ObjectClass

  • #57745

    Participant
    Points: 0
    Rank: Member

    Ahhhhh that was too easy! Thanks for that...

    Works just like I needed it to

    ((Get-ADObject -filter *) | ?{$_.name -like "admibistrator"}).objectclass

    • #57746

      Participant
      Points: 8
      Rank: Member

      If you move your filter to the cmdlet it might be faster if you're lucky

      (Get-ADObject -filter {Name -like "admibistrator"}).objectclass
  • #57752

    Participant
    Points: 0
    Rank: Member

    Even faster..thanks again sir!

The topic ‘AD Object Type’ is closed to new replies.