Get Orchestrator instance url dynamically

Hello,
We have multiple instances of the Orchestrator for different environments (UAT/SIT/Prod etc), and instead of using assets and I would like to somehow get the orchestrator URL that’s been assigned when the robot was connected and assign it to a variable.

I looked at reading the UiPath.settings file in C:\ProgramData\UiPath and then getting the value from that (works, but more assets to point to the file), and also looked at Arguments for the robot which didn’t have the required one.

Perhaps there’s some way to connect to the robot service/tray programmatically via the command line/code to extract the info below?

I would appreciate your suggestions.
Many thanks
byuli