Is it possible to get URL of the orchestrator inside the UiPath script?

I want to log the name of the orchestrator withing script.

Yes, it’s a bit of a strange process but it can be done. Hopefully in future updates this could be added to the Environment properties… But for now you can do as follows:

First you will need to know the location of the UiPath.settings file. This should be under the directory where UiPath is installed. This path is different for Community and Enterprise Studio!

Community: C:\Users\<USERNAME>\AppData\Local\UiPath\UiPath.settings
Enterprise: C:\Program Files(x86)\UiPath\Studio\UiPath.settings

Once you’ve located that, you just need 3 simple steps within a workflow…

  1. Using the Read Text File Activity, read the contents to a string variable, the .settings file is in JSON format.
  2. Using the UiPath.Web.Activities Package you can access the Deserialize JSON Activity and output the contents to a JObject variable
  3. You can access the members of that JObject variable and test it by logging the following settingsJObject("UiPathServerUrl").ToString where settingsJObject was what I named my JObject variable.
  4. From here you have access to the information you need, additionally you can assign the value of the UiPathServerUrl Element to a string variable for isolated use further along in your workflow preventing access to the remaining settings in the other portions of your workflow.

Other information is available by default such as Machine Name that the Studio is connected to via Environment.MachineName. To get the Robot ID you will need to setup an HTTP Get Request to Orchestrator as far as I’m aware.

4 Likes

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