How to get ipAddress and RobotName Correctly

Hi everyone!

I’m settin up an outcome log for some users of my processes.
I’m facing two issues.

  1. I’m retrieving the ipAddress in this way:
    Declaring the Dns variable as :
    Dns = System.Net.Dns

then assigning it to ipAddress:
ipAddress= Dns.GetHostByName(Dns.GetHostName()).AddressList(0).ToString()

the issue is that UIPath seems to do not accept Dns : image
it means: “Dns is a Net type, so can’t be used as expression”
Can anyone help me resolving this?

  1. the second issue is that I can’t find anything that allows me to get the Robot Name. I’m able to get the machine name, but I’d love to refer in log to the Ronot name, the one in yellow here:
    Does anyone know how to get this? (if it’s possible)

Thanks a lot!

Hi Maria, what did I missed?

No sorry, i deleted my response. Gave the wrong answer :slight_smile:

1 Like

Is the variable dnsName set to type System.Net.Dns

And also
For this

Kindly have a view in this thread

Cheers @Francesca_Piras

1 Like

thank you for n°2!

about n° 1:
dnsName isalready set as Dns.Net.Dns !:frowning:

Good going.
Try this, keep the variable type as System.Net.NetworkInformation.NetworkInterface[]
and the expressiong is System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces

Then do a for each loop:
get the properties by NetworkInteface.GetIPProperties()
Then from that get the dns address like IpProperties.DnsAddresses.

You will arrive at the final step heree:
Looping through all DNS addresses and finding the right one you need.

Reference docs:

for ip address declare the variable as String:

Dim strIPAddress As String = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName).AddressList(0).ToString

Hi @bcorrea
Try this

ashwin S

Hi Francesca,

Try this in a writeline activity and you will see the IP Address.