You can use Octopus.Client from inside Octopus (for example in a script step or a package install script) by referencing it as an package. You can configure nuget.org as an External Feed that provides this package. Octopus will automatically extract this package for you, allowing your script to reference the .dll file it contains using a relative path. For example:
Add-Type -Path 'Octopus.Client/lib/netstandard2.0/Octopus.Client.dll'
#r "Octopus.Client/lib/netstandard2.0/Octopus.Client.dll" using Octopus.Client; using Octopus.Client.Model;
The credentials would still need to be supplied to establish the connection.
Octopus Server and Tentacle both ship with a version of
Octopus.Client.dll in the installation directory. Avoid using this in your scripts as this is considered an implementation detail of those products. As such it is subject to change at any time, and not guaranteed to work with your version of Octopus Server.
Need support? We're here to help.