I have a list of AD groups in a text files adgroups.txt:
Audit Internal_audit IT
I want to be able to have a CSV list:
Group Name Users
Nothing else. My poweshell script I am using is:
$groups = Get-Content c:\temp\ADGroups.txt foreach($Group in $Groups) { Get-ADGroupMember -Id $Group | select @{Expression={$Group};Label="Group Name"},* | Export-CSV c:\temp\GroupsInfo.CSV -NoTypeInformation This spits out WAY to much info.
Group name Distinguished name Name Object Class etc......
Should I use a select-object and only select group name and name?