How to write PowerShell script for identify respective IP for prod targets

How to identify respective IP for prod targets

Hi @anagkumar,

Thanks for getting in touch!

Octopus only stores the IP for targets that use the listening comms method, so I will assume that is what you’re using.

To retrieve that value, you would want to use the REST API to do the following:

  • Query the machines endpoint - /api/<spaceId>/machines you may want to use a filter to only return listening tentacles within the Prod environment e.g. api/<spaceId>/machines?commStyles=TentaclePassiveenvironmentIds=<Id for Prod environment>
  • Iterate through the results and retrieve the Name and Uri fields

The only way to prevent users from creating or modifying the targets would be to ensure those users do not have the MachineEdit permission.

If removing that permission isn’t possible, you could look into creating a subscription that notifies your admins when a machine within the Prod environment is modified.

Regards,
Paul

We are happy to provide the tools needed to use our REST API, including documentation, a Swagger resource and sample scripts.

If you notice any unexpected behaviour whilst interacting with the API, we will work with you to investigate and fix any issues encountered.

Unfortunately, we are not able to write custom scripts for users.

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