How to check on a script if DHCP is allocated from the vpn server?

I use "vpncmd" command on my script for connecting to a vpn server.

vpncmd localhost /client /cmd accountimport vpnserver.vpn
vpncmd localhost /client /cmd accountconnect vpnserver

in which "vpnserver.vpn" is an account config file for the vpn server and "vpnserver" is an account name defined in that file.

But there are often failed cases for unable to receive DHCP allocation from the server, though the above command results in "connected successful".

So I wonder how to check if I received DHCP address from the server.

If I know whether DHCP was allocated or not from the server in some time limit, I could handle with that situation on my script..


How can you check on your script if your connection received DHCP allocation from the vpn server ?

Is it possible for vpncmd or windows cmd or in any program language ?