From a list of servers (`Servers.txt`), I'm getting AG and Listener name for each of them.

For being able to get `-ClusterParameter HostRecordTTL, RegisterAllProvidersIP` I need to concatenate AG\_Name+Listener\_Name:  

Ex.: `Get-ClusterResource -cluster "SERVER001" -name "AGNAME001_ISTENER001" | Get-ClusterParameter HostRecordTTL,RegisterAllProvidersIP`

The issue is when I have more than 01 AG/Listener for the same server.  

How can I concatenate AG + Listener for each line returned for same Server?

Previously I was using TOP 1, but it only got the first Line returned and some servers I got more than 04 AGs/Listeners.

```
$output = foreach ($cluster in GC "D:\Servers_List.txt")
{
    $AGName =  invoke-sqlcmd -Serverinstance $cluster -query "select top 1 left(name,25) as ' ' from sys.availability_groups order by 1" 
    $LNName =  invoke-sqlcmd -Serverinstance $cluster -query "select top 1 left(dns_name,25) ' ' from sys.availability_group_listeners order by 1" 
    $NetworkName = "$($AGName." ")_$($LNName." ")" 
    Get-ClusterResource -cluster $cluster -name $NetworkName | Get-ClusterParameter HostRecordTTL,RegisterAllProvidersIP 
} 
$output | Export-Csv 'D:\RAPIPHRTTL.csv' -NoType

```