Run script task on tentacle from within Deployment task

danielg's Avatar


16 May, 2017 05:51 PM

I need to run an arbitrary script task on a client tentacle and wait for it to complete. I need to trigger this from within a deployment step.

The scenario is performing windows updates. I have a powershell script to install windows updates. I need to run this script on the client wait, reboot, run again, wait, until there are no more updates. I don't think I can rerun a given deployment task so I thought maybe I could send a script task to the tentacle and wait till it is finished and then check again after the machine reboots.

  1. Support Staff 1 Posted by Pawel Pabich on 17 May, 2017 01:33 AM

    Pawel Pabich's Avatar

    Hi Daniel,

    Thanks for getting in touch! Unfortunately your scenario is not supported currently. If you believe it is something we should support out of the box then please describe how would you see it work in our existing User Voice suggestion.

    Please let me know if there is anything I can do to help.



  2. 2 Posted by danielg on 18 May, 2017 11:10 PM

    danielg's Avatar

    I was able to fashion something that I believe works well. It is a powershell step that runs on the server on behalf of target machines. The step uses the client API to create an adhoc script task that the server will run on the target machine. The adhoc script uses the PSWindowsUpdate powershell module to install windows updates on the target. When the adhoc script finishes the server task will check if a reboot is required and perform one if needed. It will then wait for the reboot to complete and then repeat the process until all updates have been install or there is an error.

    The script source is here If it runs well for us in the next few weeks I will submit a code request.

  3. Support Staff 3 Posted by Pawel Pabich on 18 May, 2017 11:27 PM

    Pawel Pabich's Avatar

    Thank you! Having a step template like that would be amazing.

  4. 4 Posted by danielg on 19 May, 2017 03:07 PM

    danielg's Avatar

    I do have one question though. Is there a way to run more that one ad-hoc script at a time? Right now even though the scripts are targeting different machines. They are running in serial.

  5. 5 Posted by danielg on 19 May, 2017 04:11 PM

    danielg's Avatar

    If there was a way to get access to the StartScriptCommandBuilder then I could use WithIsolation to set the isolation level of the script so that it could run concurrently. However I don't see a way of triggering that from the client API other than maybe using the OctopusUseRawScript variable and I'm not sure what side effects that has.

  6. Support Staff 6 Posted by Pawel Pabich on 22 May, 2017 12:37 AM

    Pawel Pabich's Avatar

    Hi Daniel,

    Unfortunately there is no way to run AdHoc tasks in parallel as all AdHoc server tasks share the same value of the concurrency tag (a column in our database).



Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac