Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Run Win 7 native VPN from command line for particular networks

Posted on 2014-10-30
4
179 Views
Last Modified: 2014-11-24
I'm attempting to call the native win 7 client from command line but only when the user is not connected to any of our 40 or so internal networks. Calling the VPN client is fairly easy with rasdial but how would I go about writing the rest of the script checking for example for 192.168.0.0 /24, 192.168.1.0/24 etc. networks.

thanks
0
Comment
Question by:aackar
4 Comments
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40414628
This could get difficult, as you have so many networks to check for. And are you certain there is no "conflict" with a private LAN outside of your internal networks if we only check for IP addresses?

A simple check is something like this:
route print 192.168.* | find /v "Network Destination" > nul && rasdial OfficeVPN

Open in new window

A more precise way is to check for each single network:
route print | find "255.255.255.0" | findstr /v "192.168.1.0 192.168.2.0 192.168.4.0 192.168.7.0" >nul && rasdial OfficeVPN

Open in new window

It is also possible to use text file containing the networks to check for (with one network per line), and provide that with /G:filename instead of the literal list above.
0
 

Author Comment

by:aackar
ID: 40415691
I am confident we won't run into it since most private LANs come preconfigured with either 192.168.0.0/24 or 192.168.1.0/24 and we are not using those. I am yet to see a router from
Best Buy come with a different default IP scheme.
0
 
LVL 59

Expert Comment

by:LeeTutor
ID: 40462081
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
GPO not being applied to Win7 Pro Image 5 47
Need To Expand VMware Disk Size 50 80
Cisco IPSec VPN Connection with Mac only sees Public folder 19 30
Windows 7 Internet issue 14 54
Let’s list some of the technologies that enable smooth teleworking. 
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question