Check internet is working or not using uipath

I want to check whether internet is working or not before proceeding with the desired activity. Is there any activity through i can directly perform this check.
One of the possible way is to go to cmd perform ping and get result another way is to use the following code
"System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()" store value in bool variable and use if else to perform check but every time it return true even if internet connection is not there.

1 Like


Works pretty fine .

Note : I have set the Data Type of my variable Internet to GenericValue

As per my SS1 there is Internet Connection and so it returns = “True” Check System Tray (Bottom Right)

As per my SS1 there is NO Internet Connection and so it returns = “False” Check System Tray (Bottom Right)

Hope this Helps :slight_smile:

1 Like

@prassin6, I really appreciate your help but its not working for me. I would suggest you to try same thing with if else condition. It wont work with that. I tried the way you shared your screen shots. It will give the output which we write in the writeline. Its not correct.

CheckInternetIsAvailableOrNot.xaml (6.7 KB)
please find the WF…

1 Like

@rkelchuri., Nope its giving incorrect o/p

Please disconnect your laptop/PC internet and run the script… you can see “False” message

@rkelchuri yes i tried by disconnecting my laptop still getting the same True message. Check the latest screen shot

It’s perfectly working fine for me… please check your network adopter once… and disable it… and run again.

Work Flow file shared by @rkelchuri is working absolutely fine for me.

1 Like

@prassin6, @rkelchuri, This is something strange. My machine showing no internet connection but when i run workflow shared by @rkelchuri it always show True value for me

In your machine, please check your local networks. multiple network connections might be enabled in your machine. NetworkInterface.GetIsNetworkAvailable this will always check the data packet flow. So, if your LAN is connected with a server and getting packets it always presume that you have an active connection and it will return true.

So, disable all your networks (this only possible to disable network adopter) and run the script.

1 Like

@rkelchuri, @prassin6… Thank you guys. I checked on another machine and its working fine over there.
Thanks for your help

1 Like

@rishimathur, You can try this !

Stackoverflow - Check internet connection


Might be that’s great :+1:

Dom :slight_smile:

Per Microsoft documentation, this method is checking the network interface rather than packets so there could be scenarios where this returns true and there is no network connectivity: