Formatting question

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Richard Siddaway Richard Siddaway 3 years, 7 months ago.

  • Author
    Posts
  • #9969
    Profile photo of John Gatto
    John Gatto
    Participant

    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!

  • #9970
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

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

  • #9971
    Profile photo of John Gatto
    John Gatto
    Participant

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

  • #9972
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    You're very welcome

You must be logged in to reply to this topic.