Script to unregister machine

Hi I looking for a script to unregister machines from octopus deploy

We would like to spin machines up and use them then after words have a clean automated way of removing them from octopus deploy before deleting the VM

I have a automation script that registers a new VM in octopus deploy but not the removal part

Thanks

Nick

Hi Nick,

If you’re running 2.4.4 you can make use of the Tentacle.exe deregister-from command.

If not, or if the command doesn’t suit, you can modify this Gist to remove the machine via the API:

$repository.Machines.Remove($machine) should do it.

Regards,
Nick