I need to have computer name variable add in output to foreachloop. Below is my script
$DAServers = "server1", "Server2"
$AllConnections = @()
foreach ( $a in $DAServers){
$AllConnections += get-RemoteAccessConnectionStatisticsSummary -ComputerName $a | select TotalConnections, MaxConcurrentConnections,TotalCumulativeConnections, machineName
}
$Allconnections | fl
that gives me below output.
TotalConnections : 1825
MaxConcurrentConnections : 2256
TotalCumulativeConnections : 8522
TotalConnections : 2027
MaxConcurrentConnections : 2669
TotalCumulativeConnections : 8860
But I need to add computer name also, that is not part of get-RemoteAccessConnectionSummary But I need to out computername along the other output. I trying to figure out how to add variable $a
as part of output
Any help would be greatly appreciated.
Many Thanks