Thanks for getting in touch! You can certainly obtain all the machine names during the deployment. Depending on exactly what and when you require this information, an easier option may be to take advantage of a couple system variables that you could write out in a script. For example, you could use Octopus.Deployment.Machines for the ‘Ids of machines being targeted by the deployment’, or Octopus.Environment.MachinesInRole[RoleName] and specify the role(s) a specific step is scoped to to get all machines within that specific role.
Using the Octopus.Client.dll, we have a sample PowerShell script to list all machines in the deployment which may also help.
I hope this is helpful! Please don’t hesitate to reach out if you have any further questions or concerns moving forward.
Thanks for following up, and no need to apologize for additional questions!
You can certainly obtain the target roles in which a specific step is scoped to, and probably the easiest way would be to use the system variable Octopus.Action.TargetRoles (where you can specify the step name if needed) to retrieve the role name. For example, the following script step writes out the machines that exist in the role that my previous step (called Check health) is scoped to: