$Logfile = "C:\Users\temp\Desktop\testing\$(gc env:computername).log"
while($true)
{
$server="mydb"; $port=1433; echo((new-object Net.Sockets.TcpClient).Connect($server,$port)) "$server is listening on TCP port $port";
Add-content $Logfile -value "$server is listening on TCP port $port"
Start-Sleep -Seconds 5
}
Repeated Ping ip in batch file with log
@ECHO OFF
set IPADDRESS=x.x.x.x
set INTERVAL=5
:PINGINTERVAL
ping %IPADDRESS% -n 1 >> filename.txt
timeout %INTERVAL%
GOTO PINGINTERVAL
No comments:
Post a Comment