Best way to update SSH endpoint via API

Hi -

I’m trying to update the “host” value for a number of SSH clients that were registered incorrectly. If I try to modify it directly I get an error that the URI property is “read only”:

$server = $repository.Machines.FindByName(“MyServer”)
$server.Endpoint.URI = “new value”

What’s the best way to update the uri using the API?

Hi @ShannonN,

Thanks for getting in touch! I believe Octopus handles the URI value itself by reading what the Host and Port values are. So by changing the Host and port values the URI was automatically updated for me.

The below worked in my test:

$machine = $repository.machines.FindByName("MyServer")
$machine.Endpoint.Host = ""
$machine.Endpoint.Port = "new.port.value"

Let me know if this helps or if you have any further questions at all.

Best regards,

Simple enough. Thnx for the guidance. It’s much appreciated!

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.