Thanks Mike, tried it and it takes the member count from the first group it finds and uses that for every other group. Ironically the member count of the first group is 42 - which as I’m sure you are aware is “the answer to everything”.
So it outputs the group name then 42 each time. There is also an error - along the lines of, “A parameter cannot be found that matches parameter name ‘Identiy’. On 28 May 2015, at 11:39, Marable, Mike <[email protected]<mailto:[email protected]>> wrote: How about this? $AllADgroups = Get-Content ‘path to your TXT file’ FOREACH ($Adgroup in $AllADgroups) {$Group = $Adgroup $Users = Get-AdGroupMember – Identiy $ADGroup Write-output $AdGroup $Users.count } From: stuart <[email protected]<mailto:[email protected]>> Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Date: Thursday, May 28, 2015 at 6:25 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [mssms] OT Powershell - again Just in case anyone can help. Another (what I thought) was a simple proposition. I have a list of AD Groups in a txt or csv file. I want to simply output the name of each one and the count of the users. I’m over thinking it I’m sure………… Started simply $Group = ‘myadgroupname’ $Users = Get-AdGroupMember – Identiy $ADGroup Write-output $AdGroup $Users.count This works - but can’t get the reading in from a txt or csv to work. No laughing………….. ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
