Hi,
Using the command: $a = Get-QADGroupMember $Group | select LogonName | Out-File "c:\temp\menu.txt"
I can get the logon names of the members of an AD group.
And using the command: $a = Get-QADUser -LogonName $item | select mail
$a.mail
I can get the EMail address of an AD User.
How do I take the out put of the first command and use that as an input for the second command so that I get a List of the Group members EMail addresse?
I tried this:
$TextFile = gc "c:\temp\menu.txt" | Sort-Object
foreach ($item in $TextFile) {
Write-Host $item
$a = Get-QADUser -LogonName $item | select mail }
But it does not like $item as a parameter.
Get-QADUser : The search filter is invalid.
At C:\Scripts\PS1\Get-GroupMembers.ps1:35 char:18
+ $a = Get-QADUser <<<< -LogonName $item
TIA
OldDog