locked
Can I filter on the memberof attribute when I have an array of groups? RRS feed

  • Question

  • Hi,

    The following doesn't return any Computer objects even though I see Computer objects as members of multiple groups, so can I filter on memberof when there is an array of groups in the memberof attribute?

    $Group = 'cn=DG-GroupEmail,ou=Allgroups,ou=US,Dc=Acme,DC=com'

    Get-Adcomputer -f {SamaccouintName -like "Pnb*" -and memberof -ne $Group) -pr Memberof | Select -ExpandPropery MemberOF


    Thanks for your help! SdeDot

    Thursday, December 14, 2017 2:43 AM

Answers

  • Get-Adcomputer -Filter {SamaccouintName -like 'Pnb*'} -Properties Memberof | 
         Where{$_.MemberOf -notcontains $group } |
         Select -ExpandPropery MemberOF


    \_(ツ)_/

    • Marked as answer by SdeDot Thursday, December 14, 2017 3:45 AM
    Thursday, December 14, 2017 2:55 AM

All replies

  • Get-Adcomputer -Filter {SamaccouintName -like 'Pnb*'} -Properties Memberof | 
         Where{$_.MemberOf -notcontains $group } |
         Select -ExpandPropery MemberOF


    \_(ツ)_/

    • Marked as answer by SdeDot Thursday, December 14, 2017 3:45 AM
    Thursday, December 14, 2017 2:55 AM
  • Works great!  Thanks.

    Thanks for your help! SdeDot

    Thursday, December 14, 2017 3:45 AM