Timing out a deploy using PowerShell


For one of our deployments we are using a PowerShell script to communicate with Octo’s API to wait for another deploy in another project. We are using an interval on the API to check for it’s IsCompleted property to continue. However, we don’t want the interval to loop forever and instead we want to cancel the current deploy the script is running on. We are able to use the command exit -1 or Throw in the PowerShell script to fail the deploy, but we want to exit with a timeout, so that we are able to see on the Dashboard that the deployment has been timed out.

Is there any way to timeout or cancel a deploy from within a PowerShell step?

Kind regards.


Hi Tom,

Thanks for reaching out. There’s currently no way to do anything like this besides failing the deployment with a Throw like you are doing.

There’s a uservoice suggestion open for this that could use some of your votes: https://octopusdeploy.uservoice.com/forums/170787-general/suggestions/15716922-built-in-functions-to-cancel-timeout-fail-a-deploy