A better way to get group count?

Welcome Forums General PowerShell Q&A A better way to get group count?

Viewing 4 reply threads
  • Author
    Posts
    • #279660
      Participant
      Topics: 141
      Replies: 298
      Points: 526
      Rank: Major Contributor

      I have this code to get the group with the largest count but it takes too long to run and I still don’t get the count(s) enumerated.

      Is there a more optimal way to get this info + the count in the results?

      Thanks

    • #279669
      Participant
      Topics: 9
      Replies: 707
      Points: 2,842
      Helping Hand
      Rank: Community Hero

      What do you mean you don’t get the counts enumerated? It seemed to work fine in my tests.

    • #279681
      Participant
      Topics: 141
      Replies: 298
      Points: 526
      Rank: Major Contributor

      What do you mean you don’t get the counts enumerated? It seemed to work fine in my tests.

      Well,  I get no errors but I want to see the actual numbers. I just see the Groups (and it takes a long time to recurse through so thought I’m not sorting in the right place).

    • #279831
      Participant
      Topics: 9
      Replies: 707
      Points: 2,842
      Helping Hand
      Rank: Community Hero

      Hmm I do see the numbers (how many members are in each group), with your code. Can you double check the code you’re running? $results.numberofmembers should be a list of numbers.

    • #280605
      Participant
      Topics: 141
      Replies: 298
      Points: 526
      Rank: Major Contributor

      I’m still waiting for that query to finish running but I think the PIPE is the answer i.e. takes so looooong Plus I get “Get-ADGroupMember : The size limit for this request was exceeded”

      …and this is super fast, however, I want to limit the count to everything over 50 and sort it descending.

      Where, after that pipe, would I set that? Something Like:

Viewing 4 reply threads
  • You must be logged in to reply to this topic.