cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

computer name of the machine where thingworx is used

svisveswaraiya
17-Peridot

computer name of the machine where thingworx is used

Hi,

How can I fetch the computer name of the server where the ThingWorx runtime url is being used? 

 

The snippet Subsystems["PlatformSubsystem"].GetEntityUsageReport(); is returning the computer name of the server where TW is installed originally but it is not our use case. 

 

Scenario: The ThingWorx is installed in server1 but I am running the ThingWorx url in server 2. I wanted to take the computer name of server 2 as all the plant model data are tied to server 2. The ThingWorx url will be used in multiple servers so we need the computer name of those multiple servers and NOT the computer name where ThingWorx is installed originally. Is there any service to fetch so?

 

Thanks in advance,

SV.

3 REPLIES 3

Hi @svisveswaraiya ,

 

Obtaining the hostname of the client server is not possible due to the javascript security limitations from current day browsers, they simply do not expose the client browser computer name.

In Internet Explorer there was a way in the past to obtain such information, by instantiating an ActiveX object in the webpage, but ActiveX is almost deprecated nowadays and also very insecure.

 

Regardless of this, you should rethink your way of querying the plant data. You should have plant-specific users to whom the plant model data is mapped.

Linking the plant-model data to the computer name is very fragile and unless there are missing details, I would not implement such algorithm.

 

Hi @VladimirRosu ,

Unfortunately, The plant model has been created that way and approved. The work stations are tied to the IP and computer name. So we have to automatically filter the Workstation by capturing the IP or computer name of the machine we are working in. In the client's plant there are multiple desktops in different work stations. When running the thingworx in local browser (not the place where it is installed originally) the IP in our machine is changing every time so we are not able to fetch the work station as it returns null whenever the ip is changed. That's why we wanted to take computer name.

 

Would you suggest any other method to resolve this?

 

Thanks.

First I would say that in the future whoever designs such a method of mapping should have inform him/herself better on technological limitations, since this way of mapping is just not doable, and it's not a ThingWorx limitation.

The way I would do it with the least amount of work in the current setup, is to create users specific to each workstation(WorkstationUser1,2 etc.) then add as an User Extension to the user the hostname of the computer they use (ComputerHostName1, 2 etc...) , and then you can use that to obtain the hostname,

I would then ask each workstation to use its correct Username when they login in the app.

It's completely manual, but getting the computer hostname it's just not possible via browser JS.

Top Tags