Hi All,
i am new to this forum, hoping you guys can help in getting a batch script for me which should work in windows xp and wind 7.
*Need to connect to Cisco VPN
*set the proxy in IE
*Map the network drives
I tried few batch scripts but it stops while connecting to vpn, i need it in this format, Not sure where i am going wrong.. Please help!!
echo Y | vpnclient connect
reg add HKEY_CURRENT_USER\software\microsoft\windows\currentversion\\"Internet Settings" /v AutoConfigURL /t REG_SZ /d
net use q:
batch script for vpn, proxy and network drive connection
Moderator: DosItHelp
Re: batch script for vpn, proxy and network drive connection
hi,ramkr2020
what is the proxy server name,and the port? like http://proxyservername:port
and how u map the drive like u said: net use q:
what is the proxy server name,and the port? like http://proxyservername:port
and how u map the drive like u said: net use q:
Re: batch script for vpn, proxy and network drive connection
Hi again,
Here is a batch file just remember to chaneg the test in the red "the server name and port"
unfortunately it work for XP and i'm not sure about seven
Note: I didn't test it
For more help about vbn and proxy sttings:
http://www.cisco.com/en/US/docs/security/vpn_client/cisco_vpn_client/vpn_client46/administration/guide/vcAch5.html
http://support.microsoft.com/kb/819961
http://support.microsoft.com/kb/2289942
http://support.microsoft.com/kb/308582

Here is a batch file just remember to chaneg the test in the red "the server name and port"
unfortunately it work for XP and i'm not sure about seven
Note: I didn't test it
@echo off
Cls
Mode 64,18
Color 0A
Title VPN Connection
:: Change the proxyserver with the server name and the port with the used port when connecting to the server.
SET "server=http://proxyserver:port"
:: Delete the registry file if exist to prevent errors
IF EXIST "%temp%\reg159.reg" Del /F /Q "%temp%\reg159.reg" >nul
:: Main Menu
echo.&SET /P ".= " <nul &call :C 0F "======================" end
echo.&SET /P ".= " <nul &call :C 0F "=" &call :C 0E " VPN Connection" &Call :C 0F " =" end
echo.&SET /P ".= " <nul &call :C 0F "======================" end&echo.
:: User Name Input Part
echo.&SET /P ".= " <nul &call :C 0C "UserName " end
Set /p "name= "
Set "User=%name%"
:: Password Input Part
echo.&SET /P ".= " <nul &call :C 0C "Password " end
Set /p "pas= "
Set "Pass=%pas%"
:: Profile Input Part
echo.&SET /P ".= " <nul &call :C 0C "ProfileName " end
set /p "pro= "
set "Profile=%pro%"
echo Connecting ... &ping localhost -n 3 >nul
:: Connecting to VPN Command
Echo Y | vpnclient connect user %User% pwd %Pass% %Profile%
echo Configuring IE Proxy Settings ... &ping localhost -n 3 >nul
:: This is A registry file that will set
>"%temp%\reg159.reg" (
echo.^[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings^]
echo."MigrateProxy"=dword:00000001
echo."ProxyEnable"=dword:00000001
echo."ProxyHttp1.1"=dword:00000000
echo."ProxyServer"="%server%"
echo."ProxyOverride"="<local>" )>"%temp%\reg159.reg"
:: Imprting the registry file to set the IE proxy
REG IMPORT "%temp%\reg159.reg"
echo Mapping Network Drives ... &ping localhost -n 3 >nul
cls
echo.&SET /P ".= " <nul &call :C 0F "============================" end
echo.&SET /P ".= " <nul &call :C 0F "=" &call :C 0E " Maping Network Drive" &Call :C 0F " =" end
echo.&SET /P ".= " <nul &call :C 0F "============================" end&echo.
:: Driver Letter Part NOTE enter the drive letter without the " : " capital or small letter for example: d Or D
echo.&SET /P ".= " <nul &call :C 0C "Drive Letter " end
Set /p "drive= "
Set "drv=%drive%:"
:: Network location that the drive letter will refer to, enter the copmuter name and then the shared folder for example: \\Test_Computer\shared_folder
echo.&SET /P ".= " <nul &call :C 0C "Netwrok Location " &SET /P ".= \\" <nul end
Set /p "loc="
Set "location=\\%loc%"
:: Mapping Command
NET USE %drv% %location%
:: This is a finction for coloring the text in the batch file
:C
set /p ".=." > "%~2" <nul
findstr /v /a:%1 /R "^$" "%~2" nul 2>nul
set /p ".=" <nul
if "%3" == "end" set /p ".= " <nul
del "%~2" >nul 2>nul
exit /b
For more help about vbn and proxy sttings:
http://www.cisco.com/en/US/docs/security/vpn_client/cisco_vpn_client/vpn_client46/administration/guide/vcAch5.html
http://support.microsoft.com/kb/819961
http://support.microsoft.com/kb/2289942
http://support.microsoft.com/kb/308582
Re: batch script for vpn, proxy and network drive connection
Thank you for the script abc0502, i will test it on win xp machine and update how it works.
need a similar kind of script for win 7 machines - cisco vpn client. If anyone can help , much appreciated !!
need a similar kind of script for win 7 machines - cisco vpn client. If anyone can help , much appreciated !!
Re: batch script for vpn, proxy and network drive connection
and update how it works.
what do you mean? if you asking about the batch you just modify the red line with the server and port you connect to,
and then run the batch it will ask for a user and password and profile name and then connect automatically
need a similar kind of script for win 7 machines
I will test it soon on 7 and give you the complite script that work for both but the connection to the vpn i didn't tested because i never used a vpn before, you test it
Re: batch script for vpn, proxy and network drive connection
i have one more question, when you set the proxy do you want a feature that restore the setting again to the default or the changes will be permanent, if so the last batch should work on windows 7 too
Re: batch script for vpn, proxy and network drive connection
Sorry for the late reply.
thanks for the script, . i don't want the password to be displayed.. and also please let me know what if i need to map multiple drives like Q,R,S,T,U in format \\server\folder. .
thanks for the script, . i don't want the password to be displayed.. and also please let me know what if i need to map multiple drives like Q,R,S,T,U in format \\server\folder. .