Formatting question

Welcome Forums General PowerShell Q&A Formatting question

This topic contains 3 replies, has 2 voices, and was last updated by

 
Participant
5 years, 3 months ago.

  • Author
    Posts
  • #9969

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

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

  • #9971

    Participant
    Points: 0
    Rank: Member

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

  • #9972

    Participant
    Points: 0
    Rank: Member

    You're very welcome

The topic ‘Formatting question’ is closed to new replies.