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?
wait for vpn connection to finish in batch file?
-
- Posts: 11
- Joined: Fri Sep 26, 2014 2:33 pm
-
- Posts: 2458
- Joined: Mon Feb 24, 2014 11:03 am
Re: wait for vpn connection to finish in batch file?
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"
However, batch can know IP address status by errorlevel.
netsh interface ip show addresses "adapter name" | find "IP address"