Last active
February 27, 2019 16:28
-
-
Save notmayo/278fd8c57b3bc1b1dc5949555a3b9711 to your computer and use it in GitHub Desktop.
Create a clients.txt file with one ip/hostname per line
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
set-executionpolicy unrestricted | |
clear | |
while($true) | |
{ | |
$PingMachines = Gc "clients.txt" | |
ForEach($MachineName In $PingMachines) | |
{$PingStatus = Gwmi Win32_PingStatus -Filter "Address = '$MachineName'" | | |
Select-Object StatusCode | |
If ($PingStatus.StatusCode -eq 0) | |
{Write-Host $MachineName -Fore "Green"} | |
Else | |
{Write-Host $MachineName -Fore "Red"}} | |
echo ----- | |
start-sleep -seconds 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment