Author Posts

September 6, 2013 at 10:22 am

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!

September 6, 2013 at 10:26 am

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

September 6, 2013 at 10:58 am

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

September 6, 2013 at 11:00 am

You're very welcome