Last active
May 18, 2020 13:48
-
-
Save sub314xxl/c630dc31d6d60428b071d15b7ad9d436 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Output= @() | |
$names = $(1..255 | %{"192.168.1.$_"}) | |
foreach ($name in $names){ | |
if (Test-Connection -Delay 15 -ComputerName $name -Count 1 -ErrorAction SilentlyContinue){ | |
$Output+= "$name,up" | |
Write-Host "$Name,up" -ForegroundColor Green | |
} | |
else{ | |
$Output+= "$name,down" | |
Write-Host "$Name,down" -ForegroundColor Red | |
} | |
} | |
$Output | Out-file "result.csv" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment