I have a pipeline where machines can be assigned dynamically, so each time I have new machine I need to got and add variable which is scoped to the new machine and it is reused within other steps where machine name is needed.
= MachineOne, scope to MachineOne
= MachineTwo, scope to MachineTwo.local.net
I would prefere to use Octopus variable
Octopus.Machine.Hostname instead, but as you can see from the scope hostname (or even Octopus.Machine.Name) are not suitable as machines are registered with 3 part name.
Is it possible to have a PowerShell script to parse Octopus.Machine.Hostname to get the first part of the name to pass it to variable HostName? Or is there another way?