Hi, this is my code:
$log = do # Do this
{
# Store the result of TNC in this variable to be tested until(...) is False
$tnc = Test-NetConnection -ComputerName [Address] -Port [Port]
}
if($tnc.TcpTestSuceeded -eq $flase){
$FailedDuring = $tnc.TimeStamp
}
$tnc | Select-Object -Property @{
Name = 'TimeStamp'
Expression = $FailedDuring
}, RemoteAddress, RemotePort, TcpTestSuceeded
Start-Sleep -Seconds 5
But when there is a failure to connect it I only get:
WARNING: Name resolution of Address failed
WARNING: Name resolution of Address failed
I would like when it fails to have a timestamp and if possible an output file saved to the local c:/
Any help would be great
Cheers