Monthly Archives: June 2014

AD groups – pt 2

Get-ADGroup -Filter {name -like “*”} > C:\Scripts\Glist.txt

name-like value can be changed for narrowing down Group Names such as Account* will include all Accounting.US, Accounting.International, etc

Notepad++- Bookmark lines containing “SamAccountName”, remove Unbookmarked lines,  Replace “SamAccountName    : ” with nothing and save.

Then as a script run:

$groups = Get-Content c:\Scripts\Glist.txt

foreach($Group in $Groups) {

Get-ADGroupMember -Id $Group | select @{Expression={$Group};Label=”Group Name”},* | Export-CSV c:\Scripts\GroupsInfo.CSV -Append -Force -NoTypeInformation

}