Connecting to Octopus Server from PowerShell

Hello, I’m new to Octopus Deploy and trying to use it with PowerShell. The goal is to connect to the Octopus Deploy Server from PowerShell and run some scripts that do the following:

  1. Verify if all deployment targets (tentacles) are available
  2. Verify if free disk space is 10GB in each target.

My question regarding the above:
a) How do I connect to the Octopus Server from PowerShell?
b) Can I run scripts on the Octopus Server that accomplishes the above goals? If so, how?
c) Can I run the same scripts from PowerShell to do those same tasks? If so, how?

Thanks and please let me know if I need to provide more clarity.

Hi,

Thanks for getting in touch! You can connect to the Octopus REST API via PowerShell to perform tasks like this. Since Octopus was developed API-first, anything that can be done via the UI can also be done via the API.

To connect with this, you’ll need to provide your Octopus URL and a valid API key. You can learn more on our API wiki and reference sample API scripts in our public repo. In the Targets section, there’s a sample script to check health of machines in all environments. Feel free to add any helpful scripts for others to benefit from as well. :slight_smile:

I hope this helps get you going! Don’t hesitate to reach out if you have any further questions going forward.

Kind regards,

Kenny

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