Link to home
Start Free TrialLog in
Avatar of adbyits
adbyits

asked on

BATCH FILE TO TO WORK OUT IF I AM ON THE LOCAL NETWORK OR REMOTE

HI all i need to write a batch file for my client to run to map a network drive but first i need to see if he is remote or on the vpn, just wondering how i do this
Avatar of Bill Prew
Bill Prew

There are a few commands you could use to query the state of your current network connections, and then look for things that indicate when you are VPN connected and when you are not.  Often the name of an adapter will contain the word "vpn" and that can be checked for, but that varies system to system based on the vpn client being used.

I would suggest you do the following commands on the system when not connected via VPN, and then do then when connected to VPN.  Then you need to look for the differences, and something that could be used to identify when a VPN connection is active.

If you want to post up the before and after output we can look at that and guide further.

netsh interface show interface

ipconfig /all

wmic nicconfig get /format:csv

I often prefer the last one, since the output can be parsed fairly easily in a BAT FOR loop, but if the firts one shows a clear difference for VPN that can be simple too.

~bp
Avatar of adbyits

ASKER

cool thanks BP but i need a batch file to tell me when it is and when uits not and then run a command
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial