Skip to content

Instantly share code, notes, and snippets.

@CraigChamberlain
Last active November 10, 2021 21:08
Show Gist options
  • Save CraigChamberlain/4db39ebb4339ee11cc5e9cd817e3dcbf to your computer and use it in GitHub Desktop.
Save CraigChamberlain/4db39ebb4339ee11cc5e9cd817e3dcbf to your computer and use it in GitHub Desktop.
Makes
while($true){
$timeStamp = (Get-Date).toString('yyyy-MM-dd-HH-mm-ss')
$path = $pwd.Path + "\" + $timeStamp + ".txt"
Start-Job{
try{
Invoke-WebRequest https://www.dundasparksgolf.co.uk/ > $null
"Success`t"+$using:timeStamp
} catch
{
$error[0] > $using:path
"Failure`t"+$using:timeStamp
}
} > $null
Start-Sleep 60
Get-Job | Where-Object {$_.State -in "Completed", "Failed"} | Receive-Job -Wait -AutoRemoveJob
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment