2008-10-22

Check_Remote.au3

rem -
rem Place in StartUp folder - it will check to see if you're
rem onsite or remote if remote it will start the  VPN dialer
rem with your fob-prefix...
rem -
rem requires AutoIt
rem -
@echo off
echo .>remote.txt
ping yourserver>>remote.txt
rem  ^-a server on your systems...
for /f %%i in ('find "timed out"^>remote.txt /c') do if not '0'=='%%i' goto offsite
goto xit
:offsite
echo Dim $fobpfx=RegRead('HKCU\Software\check_remote','^$fobpfx')>>VPN.au3
echo If $fobpfx='' Then >>VPN.au3
echo   $fobpfx=InputBox(@scriptname,'^$fobpfx','9999','*')>>VPN.au3
echo   RegWrite('HKCU\Software\check_remote','$fobpfx','REG_SZ',$fobpfx)>>VPN.au3
echo EndIf>>VPN.au3
echo Run('"C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe"')>>VPN.au3
echo WinWaitActive('status:')>>VPN.au3
echo Send('{ctrlDown}o{ctrlUp}')>>VPN.au3
echo WinWaitActive('VPN Client')>>VPN.au3
echo Send($fobpfx)>>VPN.au3
call VPN.au3
goto xit
:xit
if exist remote.txt del remote.txt
if exist vpn.au3 del vpn.au3

No comments:

LibriVox's New Releases

Blog Archive

Powered By Blogger