No output file is created when timeout is reached.
Problem code:
# timeout after $Seconds...
if ($Seconds -ne 0 -and ($([DateTime]::Now) -gt $starttime.addseconds($Seconds))) {
return
}
solution
# timeout after $Seconds...
if ($Seconds -ne 0 -and ($([DateTime]::Now) -gt $starttime.addseconds($Seconds))) {
$running = $false
}