wait for vpn connection to finish in batch file?

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
sdevries.otn
Posts: 11
Joined: Fri Sep 26, 2014 2:33 pm

wait for vpn connection to finish in batch file?

Post by sdevries.otn » Mon Oct 27, 2014 9:03 pm

I am trying to write a bat file to:
1) Connect to VPN
2) Open RDP
3) Close VPN after RDP is closed.

So far:
start /wait vpncmd localhost /client /cmd AccountConnect <VPN Connection Here>

start /wait mstsc.exe <rdp file name>

start /wait vpncmd localhost /client AccountDisconnect <VPN Connection Here>

Notes:
Unfortunately, this seems to fire the RDP immediately. I'd lke to have it wait until after the IP Address window closes. I can manually time a break, but that does not really gaurantee a connection is established. Is there another vpncmd I can run using start /wait that will wait until an ip is established?

thisjun
Posts: 2458
Joined: Mon Feb 24, 2014 11:03 am

Re: wait for vpn connection to finish in batch file?

Post by thisjun » Thu Nov 06, 2014 7:36 am

Vpncmd doesn't have such command.

However, batch can know IP address status by errorlevel.
netsh interface ip show addresses "adapter name" | find "IP address"

Post Reply