How to export server names

How do I export all of our servers we have to say, CSV or textfile or something?

Hi,
Thanks for getting in touch! One option which comes in mind could be to use our API which you can query using PowerShell, through our Octopus.clients .NET library.

We also have quite an extensive wiki for our API which you can browse by starting at the wiki home on Github.

From there you could check out some of our PowerShell samples that you can work off to achieve the goal of exporting out the Machines.

For example, if you setup a new PowerShell script that creates a $repository, you can proceed to get your Machines using a strategy like this:

# You can this dll from your Octopus Server/Tentacle installation directory or from
# https://www.nuget.org/packages/Octopus.Client/

Add-Type -Path 'C:\bin\Octopus.Client.dll' 

$OctopusServerApiKey = 'API-******************'
$OctopusServerUrl = 'https://<OctopusServerURL>/'

$endpoint = New-Object Octopus.Client.OctopusServerEndpoint $octopusURI, $apiKey
$repository = New-Object Octopus.Client.OctopusRepository $endpoint

$repository.machines.getAll()


EnvironmentIds                  : {Environments-3}
Roles                           : {Role}
TenantedDeploymentParticipation : Untenanted
TenantIds                       : {}
TenantTags                      : {}
Name                            : HOSTNAME
Thumbprint                      : ***************************************
Uri                             : https://***.***.***.***:10933/
IsDisabled                      : False
MachinePolicyId                 : MachinePolicies-1
Status                          : Offline
HealthStatus                    : Unavailable
HasLatestCalamari               : True
StatusSummary                   : **Omitted**
IsInProcess                     : False
Endpoint                        : Octopus.Client.Model.Endpoints.ListeningTentacleEndpointResource
Id                              : Machines-1
LastModifiedOn                  : 
LastModifiedBy                  : 
Links                           : {[Self, /api/machines/Machines-1], [Connection, /api/machines/Machines-1/connection], [TasksTemplate, /api/machines/Machines-1/tasks{?skip,take}]}

From here, you could take the resulting machines and use the PowerShell cmdlet convertto-csv to generate your CSV content.

I hope this has given you enough to get you going, please feel free to keep in touch if you have any questions!

Kind regards,
Lawrence.