cancel
Showing results for 
Search instead for 
Did you mean: 

how to find ipaddress from process studio

satishreddy2
Level 3
hi all,
can anyone of know how to find ip from process studio of current machine on which i am running blueprism. I have tried with utility-environment vbo but not found any solution.

------------------------------
satish reddy
------------------------------
2 REPLIES 2

Hello Satish, 

I am not aware of an action that can do that in any of the VBOs that ship with Blue Prism out of the box. However, you may be able to write a code stage if you or anyone in your team is comfortable using C# or VB.net to leverage the .NET framework to get your local IP address. I played with this a while and I am providing an example I created just to show you what you can do if you want to pursue this route. The VBO and the code contained in the 'Get Local IP Addresses' code stage were written in VB for guidance purposes only. This VBO or code is not intended to solve your specific issue, it is meant to show you a possible option and will require that you adjust the example to get it to do what you need. 

The example takes a hostname as a string parameter (your local computer name for example) and returns a collection of all IP addresses (as strings) that an 'ipconfig' command would return using the command prompt window. 

I also suggest taking a look at our documentation called 'Extending Automations using the .NET Framework' available from the BP Portal in case this example helps: 

https://portal.blueprism.com/system/files/2017-09/Blue%20Prism%20Data%20Sheet%20-%20Extending%20Automations%20using%20the%20.NET%20Framework.pdf


Best regards,

------------------------------
Jorge Barajas
Blue Prism
Senior Product Consultant
Austin, Texas
------------------------------
Jorge Barajas Blue Prism Senior Product Consultant Austin, Texas

NicholasZejdlik
Level 9
The answer to this is complicated by the fact that there can be more than one IP address per machine. I'd check out this StackOverflow thread with more of an explanation. One solution that seems to work particularly well is this one, which you can implement in the below code stage.

Inputs: None
Outputs: Local IP
Using Sock As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0)
	' Because we are using UDP (SocketType.Dgram), Connect() will not actually connect to anything,
	' but it will calculate the route to use which should give us the IP that we're looking for.
	Sock.Connect("8.8.8.8", 65530)
	Dim EndPoint As IPEndPoint = Sock.LocalEndPoint
	Local_IP = EndPoint.Address.ToString()
End Using​

You'll need to edit the Code Options and add System.Net and System.Net.Sockets to the Namespace Imports section.

This seemed to work well for me, but you'll want to double check that the IP address it is calculating is the one you're looking for. If not, you'd need additional code to search through the various addresses assigned to your machine.

------------------------------
Nicholas Zejdlik
RPA Developer
------------------------------