When configuring Content Delivery, it is necessary to register the capabilities of the environment with the discovery service. It is useful to be able to read the currently registered capabilities directly from the discovery service. It is possible to do this using the registration tool, but this scripted approach using PowerShell gives an alternative with the potential to be extended into yet more useful tools.
You can download the script here: DiscoverEnvironmentCapabilities.ps1
Running the script
From the folder where you have downloaded the script, you can call it like this:
PS > .\Discover-EnvironmentCapabilities.ps1 -discoveryURL http://cd.local:8082/discovery.svc -client_id cduser -client_secret CDUserP@ssw0rd
If the client Id and secret are still at their default values, you can omit these paramaters.
The output looks like this:
The output shown above comes from a fairly bare-bones Tridion system. As you can see the script reads the possible capabilities from the service metadata (in the EntityType navigation properties) and tries to look up each capability in the /Environment node of the service. If it's found, you'll see True in the Found column, and where relevant, a URI for the capability's service endpoint.
Writing this kind of script is made easier by examining the metadata directly with a tool like Postman or Insomnia. There's a lot more information available than just the capabilties.