Removing Tentacles

We have a lot of Virtual Machines that are only on when they are in use. After a period of time of unuse, they are turned off. Sometimes these machines are replaced with new machines. When a new machine is created, we are automatically registering it with Octopus.

My question is this: Is there a way to deregister/remove the old machine from Octopus even though that machine may not be turned on? We are running in a hosted environment and turning that machine on, waiting for it to boot, removing the tentacle and then turning it back off takes too long, costs a lot more in development, and also costs us extra as we get charged when machine is on.

What I need is a way to tell Octopus Server to just delete the machine from it’s environments.

Thanks in advance,


Hi Brian,

Thanks for reaching out! I’m asuming you’re asking for a way to do this programatically, as from the UI is as easy as clicking on the tentacle, and then on Delete

If you want to go the code-way, you can do so by using the Octopus REST API. This code snipped shows how to delete a machine using Powershell and the REST API

$OctopusURL = " " #Your Octopus URL
$OctopusAPIKey = " " #Your Octopus API Key
$header = @{ "X-Octopus-ApiKey" = $OctopusAPIKey }

Invoke-WebRequest $OctopusURL/api/machines/machines-449  -Method Delete -Headers $header

you’ll need to get the machine ID and set its value on the code to make this work. The example shows how to delete the machine with the ID “Machines-449”

Hope that helps!



Using this method, is it possible to first get a list of offline machines?


Hi Russ,

Thanks for reaching out. If what you are looking for is to get a list of all offline machines and then delete them, you can use the Octoposh module for this.

Here’s a gist of how to remove all offline machines using the Powershell module:

Hope that helps!


Perfect, thanks!