Find Membership Count of all AD Groups in OU

I was working on an application migration recently, and wanted to see how many users/computers were in each application Active Directory (AD) group in a specified Organisational Unit (OU):

 

Count members of an AD Group and write to CSV

This script finds all AD groups beginning with ‘MSI – ‘ or ‘App-V – ‘ and returns the number of members it contains.  Note that it doesn’t recurse nested groups!  It then outputs the results to a CSV file.