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
|