$logFile = 'C:\xampp\htdocs\kptv2\kptv_inslastfive.log' $ts = Get-Date -Format 'yyyy-MM-dd HH:mm:ss' try { # Force TLS 1.2 -- on Win Server 2016 the default still falls back to TLS 1.0 # which Apache rejects, causing Invoke-WebRequest to throw silently (the # catch block was hiding the real error so the task reported success). [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $r = Invoke-WebRequest -UseBasicParsing -Uri 'https://testsite2.kptv.ro/ro/inslastfive.php' -TimeoutSec 10 Add-Content -Path $logFile -Value ("{0} OK status={1} len={2}" -f $ts, $r.StatusCode, $r.RawContentLength) } catch { Add-Content -Path $logFile -Value ("{0} ERR {1}" -f $ts, $_.Exception.Message) } x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586