Run script task on tentacle from within Deployment task

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.

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.

Regards,

Pawel

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 https://github.com/DanieGu/Library/blob/windows-install-updates/step-templates/windows-install-updates.json If it runs well for us in the next few weeks I will submit a code request.

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

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.

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.

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).

Regards,

Pawel