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