From
http://blog.degree.no/2011/10/permanent-vpn-connection-in-windows/
http://blog.degree.no/2011/10/permanent-vpn-connection-in-windows/
$ip = "some address or ip" $result = gwmi -query "SELECT * FROM Win32_PingStatus WHERE Address = '$ip'" if ($result.StatusCode -eq 0) { Write-Host "$ip is up." } else{ Write-Host "$ip is down." Write-Host "Disconnecting..." rasdial.exe xxxVPN /DISCONNECT Write-Host "Connecting..." rasdial.exe xxxVPN vpnUsername vpnPassword12345 }
Comments
Post a Comment