Get-Content Only Outputting Last Line

Viewed 14

In my following code, I want it to output each AD group. However, it is only outputting the last AD group listed in the text file. How can I output each AD group?

$ADs = Get-Content -Path C:\Users\username\Documents\EditADGroupNotes.txt 

foreach ($AD in $ADs){
$ADGroup = Get-ADGroup -Identity $ADs | select name
}
1 Answers

@olaf answered this.

Changed to:

Get-ADGroup -Identity $AD | select name
Related