locked
Writing ComputerName value to Write-Host RRS feed

  • Question

  • Hi

    Currently stuggling to get the actual computer to be written to Write-Host

        if (Test-Connection $_.Name -Count 1 -Quiet) {
        Write-Host {"$_.Name Online"}

    I'm getting the syntax wrong somewhere but cannot figure out where?

    Any help really appreciated guys

    Wednesday, June 10, 2020 2:34 PM

Answers

  • Try this:

    if (Test-Connection $_.Name -Count 1 -Quiet) {
        Write-Host "$($_.Name) Online"
    }


    --- Rich Matheisen MCSE&I, Exchange Ex-MVP (16 years)

    • Proposed as answer by Vector BCO Thursday, June 11, 2020 5:50 AM
    • Marked as answer by Beefstew123 Thursday, June 11, 2020 4:32 PM
    Wednesday, June 10, 2020 2:43 PM