Select item from dynamic multidimensional arraylist

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Jack Neff Jack Neff 1 year, 9 months ago.

  • Author
    Posts
  • #22658
    Profile photo of Juli
    Juli
    Participant

    I have an arraylist that is dynamic. It is created from the results of a get-mailboxexport command. Each entry has 3 values. 2 will definitely contain duplicate values and the other will potentially contain duplicates.

    I only need to use 2 of the values however. So I have an Identity value and a status value. I need to be able to find all duplicate identity's where at least one status is 'Failed'.

    I found this example $arrPies | Group-Object | Where-Object {$_.Count -gt 1} but it doesn't quite seem to fit this situation. So I have tried this:

    foreach ($i in $test)

    {select-object -identity | group-object | where-object {$i.count -gt 1}

    $i.identity

    }

    This still does not return any value. At this time I am not comparing the Status value, just wanting it to select any items where there are duplicate identities.

  • #22667
    Profile photo of Jack Neff
    Jack Neff
    Participant

    Your first example was close but you should specify the property that Group-Object should focus on like:

    $arr | Group-Object -Property Identity | Where-Object {$_.Count -gt 1}

You must be logged in to reply to this topic.