How To Count The Number Of Objects In A Security Group – PowerShell Script

IT Support Forum Forums Active Directory Users And Computers How To Count The Number Of Objects In A Security Group – PowerShell Script

Viewing 0 reply threads
  • Author
    Posts
    • #1037
      Webmaster
      Keymaster

      Today a colleague and I had a competition to write a script to count the number of users in an AD security group. My colleague made a PowerShell script to count the users in the group, while I worked on a command line script using dsquery. I finished first, but only because I found a copy of a script I made before. Here’s the PowerShell script:

      (Get-ADGroupMember -identity “domain admins”).count

      The PowerShell script was much better than mine, because my script outputted the users in a group into a CSV, which I then opened in Microsoft Excel and counted the number of rows.

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