Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2006, 04:51 PM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBSCRIPT

Hello people, I am new to vbscripting I come from the DOS days of automation using batch files. First of all I have about 250 - 300 traveling sales reps that I support on a daily basis. With differant levels of knowledge in computer use. My task is to make it easier for my helpdesk team to support these users. I have written this batch file that will disable the windows firewall, start a vpn connection, launch a pcAnywhere host, and display the users IP address(s) so that they can read it out to the helpdesk. I will show my code in a bit. now the problem is that I would like to know if there is a way to create a vpn connection through vbscript, reason being is that everyone there vpn connection named differantly depending on who configuered it. My hopes is to create a new connection through a vbs and if possible delete any other ones they might already have. Then I can make my batch launch the newly created vpn connection instead of having to walk the user through changing the name to there vpn connection before they excecute my batch file. Now as promissed here is my batch file.

REM *************************Batch Source Code***********************
@echo off
REM ================================================== ====================
REM
REM NAME: Support.bat
REM
REM AUTHOR: Leonardo Cruz, Leegin Creative Leather
REM DATE : 9/8/2006
REM
REM COMMENT:
REM Batch file used to turn windows xp firewall, launch the leegin vpn and
REM launch the pcanywhare host to allow access to there laptops. Once we
REM service has completed on computer you can simply press the
REM spacebar to
REM turn firewall back on.
REM Copyright: This batch file can not be modified copied or used in REM any whay with out written permission by author.
REM ================================================== ====================

if exist "c:\Leegin Drivers\Scripts\Firewall_Off.vbs" goto continue else goto make

:make
REM Create Scripts directory
md "c:\Leegin Drivers\Scripts"
REM Create the Firewall_Off.vbs Script
echo Set objFirewall = CreateObject("HNetCfg.FwMgr") >> "C:\Leegin Drivers\Scripts\Firewall_Off.vbs"
echo Set objPolicy = objFirewall.LocalPolicy.CurrentProfile >> "C:\Leegin Drivers\Scripts\Firewall_Off.vbs"
echo objPolicy.FirewallEnabled = False >> "C:\Leegin Drivers\Scripts\Firewall_Off.vbs"

REM Creae the Firewall_On.vbs Script
echo Set objFirewall = CreateObject("HNetCfg.FwMgr") >> "C:\Leegin Drivers\Scripts\Firewall_On.vbs"
echo Set objPolicy = objFirewall.LocalPolicy.CurrentProfile >> "C:\Leegin Drivers\Scripts\Firewall_On.vbs"
echo objPolicy.FirewallEnabled = True >> "C:\Leegin Drivers\Scripts\Firewall_On.vbs"

goto continue

:continue

REM Disable the windows firewall
echo Your firewall is being disabled
start /w wscript.exe "C:\Leegin Drivers\Scripts\Firewall_Off.vbs"
cls
echo Your firewall has been disabled

REM Start the Leegin VPN
rasdial "Leegin Vpn" salesvpn leeg1n
cls
echo You are now connected to Leegin Vpn

REM Start PcAnywhere
awhost32.exe
echo.
echo pcAnywhere is running
echo.
echo.
echo.
ipconfig.exe | find "IP Address" | find /v " 0.0.0.0"
echo.
echo.
echo.
echo To Activate your firewall please
Pause
cls

REM Disconnect from Leegin Vpn
echo You are being disconnected from Leegin Vpn
echo and your firewall is being activated.
rasdial "Leegin Vpn" /Disconnect
cls

REM stop the pcAnywhere host.
stophost .ex

REM Activate windows firewall
echo Do not close this window it will
echo close automaticly.
start /w wscript.exe "C:\Leegin Drivers\Scripts\Firewall_On.vbs"

REM Close Command Prompt
exit
 
Old September 11th, 2006, 05:02 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You may be able to achieve this through a WSH (windows script host) file which you can use VBScript to write.

Google: WSH or windows script host

"The one language all programmers understand is profanity."
 
Old September 11th, 2006, 05:05 PM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have searched but have not been able to find anything that I can use. any other suggestions
 
Old September 11th, 2006, 09:28 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Very rarely have I come across a problem that cant be solved through some sort of programatic methods, unfortunately, I am not very familiar with WSH programming so really can't point you in any other direction.

Regards.

"The one language all programmers understand is profanity."





Similar Threads
Thread Thread Starter Forum Replies Last Post
VBScript junedali10 VB How-To 3 September 27th, 2006 03:06 PM
Need Help in VBScript ragavendran31 Pro VB 6 0 April 19th, 2006 05:54 AM
Using VBScript and JSScript together? hayley02 Classic ASP Professional 2 June 7th, 2004 01:25 PM
Using JScript with VBScript jwalborn Javascript How-To 4 October 13th, 2003 10:07 AM
Using VBScript and JavaScript together jwalborn Classic ASP Professional 2 October 13th, 2003 10:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.