Script Console Functionality via API?

I am writing a utility app to monitor my servers and a lot of the functionality I want is already built in to OD via the script console. Is there a way to launch a PS script via the API on either a specific server or group of servers? Again, same functionality as the script console but via the API.

Thanks,
Luke

Hi Luke

Thanks for getting in touch.

You can definitely use the API for this, I’ve created a simple sample Gist for you here https://gist.github.com/DamianMac/a944c0fcab6db531e7a5 that you can use as a starting point (assuming you’re using Octopus.Client).

If you’re calling the REST API directly with some other language let me know and I can show another way, but you should get the idea.

Regards

Damian

Damian, if you would be willing to share an example with the REST API that would be awesome. We are looking to create a slackbot to run some adhoc powershell via a POST. I looked over the Tasks page in the Octopus REST API, but I only see names of Backup, Health, Retention, Upgrade, TestEmail. Should AdhocScript be listed in the documentation too?

Hi Pat,

Thanks for getting in touch.
We’ve updated the API docs on GitHub so it’s now in there.

The easiest way to figure out what you want though would be to run Fiddler (or similar) while using the GUI, then capture that output and you’ll have exactly what you need.

Regards

Damian