How to use Powershell activity to perform Ping test on a particular IP?

Hi guys,

How to use Powershell activity to perform Ping test on a particular IP address?

I need to check if my system is connected to a VPN or not. If it is connected then it should return true, if not the it should connect to VPN. Usually I do it by opening the web application and checking the url.

How can we check this using Powershell activity?? What all thing I should pass to the properties, any examples would e helpful.

Thanks in Advance.

Hi @batBot

Refer to below snippet, although it is not by Powershell activity, it also can be used to ping test.


Hi thank you for the reference, I went through the link I want to check if my sys is connect to a VPN (IP address) not just internet. Can this be done. Any examples if you have it?

You can check with the output count of the powershell,


I guess that we have to define the Get-VpnConnection right?

Because I get a error "Invoke Power Shell: The term ‘Get-VpnConnection’ is not recognized as the name of a cmdlet, function, script file, or operable program.

Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

How to correct this? Thank you

Tick mark IsScript property of powershell activity in property panel.

I check it but shows the same error. Sometimes it executes but does not return anything

But its running for me without any error.

Not returning anything.

Whether you have connected to VPN???..

It is not going to if part

I connected to VPN and it is showing the same error

Check this workflow and script file inside zip folder @batBot (356 Bytes), and
SampleSequence.xaml (26.9 KB)
download the Uipath.Script.Activities package.
It will return true or false as a output.


Thank you for the PS file but its returning only false every time. Eve when I connected to vpn its returning false.

Do i have to make any changes to the code in ps file.?

If you have any other Powershell script, then just edit the ps file and check.

Whether you know your vpn name, then use below script and check, @batBot

“$VpnName = ‘TestVPN’
if((Get-VpnConnection).Name -eq $VpnName)
return $a = “True”
return $a = “False”

Hi @batBot

Their is an Direct Activity for this Ping in Uipath Market Place.
Please use this “Atos - Ping Activity - RPA Component | UiPath Marketplace” link to download and Provide your valuable feedback.

Sharmila Sundar