VPN connection check and if disconnected then connect

Hi,
I want to check the VPN is connected or not if not then i want to connect by providing the username and password.

Please guide me how to automate the task.

Sure.
It can be done by an invoke code activity.
First you can import this two namespaces (add them in imports tab):

System.Net.NetworkInformation;
System.Diagnostics;

then paste this code into the invoke code activity:

Dim connected As Boolean
For Each networkInterface As NetworkInterface In NetworkInterface.GetAllNetworkInterfaces()
	If networkInterface.Name = "VPN_Name" AndAlso networkInterface.OperationalStatus = OperationalStatus.Up Then
		connected = True
		console.WriteLine("VPN already connected")
	End If
Next
If Not connected Then
	Dim startInfo As ProcessStartInfo = New ProcessStartInfo()
	startInfo.FileName = "rasdial.exe"
	startInfo.Arguments = "VPN_Name VPN_UserName VPN_Password"
	Process.Start(startInfo)
End If

Just replace VPN_Name, VPN_UserName and VPN_Password or use variables instead of them.

regards,
Konrad