I'm creating a PowerShell script that I'm going to execute using Start-Job
. The job should continuously run in the background until I tell it to stop using Stop-Job
. It should execute a SQL command on a timer with a specified duration and output the results to the jobs pipeline so I can retrieve them using Receive-Job
.
Right now the job runs properly but I don't have it setup to continue running after initial SQL command execution (I don't have the timer implemented).
What is the proper way to implement a timer in a PowerShell job so that the job runs continuously?