You can use PowerShell job cmdlets to achieve your goals.
There are 6 job related cmdlets available in PowerShell.
- Get-Job
- Gets Windows PowerShell background jobs that are running in the current session
- Receive-Job
- Gets the results of the Windows PowerShell background jobs in the current session
- Remove-Job
- Deletes a Windows PowerShell background job
- Start-Job
- Starts a Windows PowerShell background job
- Stop-Job
- Stops a Windows PowerShell background job
- Wait-Job
- Suppresses the command prompt until one or all of the Windows PowerShell background jobs running in the session are complete
If interesting about it, you can download the sample How to create background job in PowerShell