Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Format from a Variable

$
0
0


$strcomputers = "computer1", "computer2"
$failoutput = "location, state `n"

foreach ($strcomputer in $strcomputers)
{
$test = "$($strcomputer), is online. `n"
if (!(test-connection -computername $strcomputer -count 1 -quiet))
{
$test = "$($strcomputer), is not online or exsist. `n"
}
$failoutput += $test
}
$failoutput


Viewing all articles
Browse latest Browse all 13067

Trending Articles