Formatting question

I have a question that seems really simple, but it has me stumped. I would like to take a simple list of computer names that I have obtained via get-adcomputer, and output the list to text file with all names on a single line, separated by commas. Thanks in advance!

Try this
Set-Content -Path computers.txt -Value ((Get-ADComputer -Filter * | select -ExpandProperty Name) -join “,”)

That’s exactly what I was looking for. Thank you!

You’re very welcome