system.device.getDeviceHostname?

I am looking for a way to get a list of the IP addresses of devices configured on the gateway. I know I can use system.device.listDevices to get the gateway connection status of each device which returns a dataset of the device names, enabled status’, connection status’, and driver names. And I know there is system.device.setDeviceHostname which would allow setting the IP address of a given device from scripting.

I am looking for something like a system.device.getDeviceHostname, which as far as I can tell does not exist. Is there any way to get this information from the scripting environment?

If you browse to your device with the OPC Browser you will see that it contains a Diagnostics folder. Within the Diagnostics folder is a tag that contains the hostname. You can drag this tag into the Tag Browser and then read the value in your script with the system.tag.read() function.

1 Like

That worked out great.

Thanks for the suggestion Greg!