Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding static route using VBScript

Status
Not open for further replies.

12oclock

Technical User
Mar 7, 2014
1


Dear all,

I would like to ask if someone ever created vbscript as described in following steps:

Get active interface name
Get IP address of active interface
Get default gateway on active interface name
Add static route 1 via active interface name (from the information gathered from instructions)
Add static route 2 via active interface name and default gateway (from the information gathered from instructions)

I need to pass above vbscript to clients as soon as ssl-vpn connection is established.

lets call it session-start script This is needed because I need to use split-tunnel only for 2 static destinations. The rest of the traffic is passing via HQ = NO split-tunnel allowed.

Once client finish the ssl-vpn session, there must be another end-session script which will delete previously added static routes.

So far, I did following script
[sup]strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter Where NetConnectionStatus = 2")
For Each objItem in colItems
sActiveName = objItem.Name
next
Set colItems = objWMIService.ExecQuery( _
"Select * from Win32_PnPSignedDriver where deviceclass = 'net' and Devicename = '" & sActiveName & "'")
For Each objItem in colItems
Next[/sup]

...however I do not know how to continue to finish my goal. I would be very thankful if one can help me to accomplish this challenge.

Thank you very much all beforehand!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top