I cobbled together the powershell commands below to export the list of servers which are members of a security group to csv. I have a number of commands which produces its own csv. Instead of having a dozen csv files, I want to produce one csv overall with two columns, server name and the security group it is in. How can this be done?
Get-ADGroupMember -identity "SecGrp-123" -server "test.net" | select name | sort-object name | export-csv "SecGrp-123.csv" -NoTypeInformation
Get-ADGroupMember -identity "SecGrp-456" -server "test.net" | select name | sort-object name | export-csv "SecGrp-456.csv" -NoTypeInformation