Navigation

monitor

Powershell - network monitor via ping

$servers = "seznam.cz","google.cz"
$collection = $()
$OutputFile = "D:\test\output.csv"
do {
	foreach ($server in $servers)
	{
		$status = @{ "ServerName" = $server; "TimeStamp" = (Get-Date -f s) }
		if (Test-Connection $server -Count 1 -ea 0 -Quiet)
		{ 
			$status["Results"] = "Up"

		} 
		else 
		{ 
			$status["Results"] = "Down" 
			$now = Get-Date -uformat "%Y/%m/%d %H:%M:%S"
			$out = $status["ServerName"] + " = " + $status["Results"] + " - " + $now
			$out | Out-File $OutputFile -append
		}
		sleep 1
		
		# $now = Get-Date -uformat "%Y/%m/%d %H:%M:%S"
Subscribe to monitor