Syed Jahanzaib Personal Blog to Share Knowledge !

October 8, 2013

PPPoE Dialer via DOS Batch File

Filed under: Microsoft Related — Tags: , , , — Syed Jahanzaib / Pinochio~:) @ 1:53 PM

Changelog:

8th Oct , 2013 9:30pm : Entry added  to create network profile folder if not already there (usually on fresh win7)
9th Oct , 2013 01:45pm : Entry added  to create new phonbook profile, it will not overwrite or delete previous one 🙂

Following is a simple and quickest method to create pppoe dialer using MSDOS batch file made for Windows 7, which create a new rasphone profile for PPPoE Dialer. Usually this sort of work is done using VB , or VB/VC# .NET with Dotras type programming languages which does the job nicely with lots of options and fancy look menus etc, but due to my limited knowledge towards programming, I decided to go with my traditional CLI method. I created this batch program in a very short time without much googling.

Phonebook Location to store profiles (new and old)

%userprofile%\AppData\Roaming\Microsoft\Network\Connections\Pbk\

This is just an example, you can modify at as per your requirements , The issue i faced while adding multiple lines was white space at the end, and if there are additional white spaces in the file , rasphone will not detect the new entry. therefore I later used algorithm to remove white spaces.

Any suggestion to improve the method will be highly appreciable . . . Please psot your comment if this batch file is working ok for you . . .

Let’s Start.

Create a new batch file like

notepad c:\dialer.bat

Paste following data and save.

@echo off
rem
rem #########################################
rem ### PPPoE Dialer Script for Windows 7
rem ### Syed Jahanzaib / aacable@hotmail.com
rem ### http://aacablw.wordpress.com
rem #########################################

rem ### Creating pppoe profile in a temporarily text file
echo. 2>  c:\rstemp.txt
echo [AA_PPPoE_Dialer] >> c:\rstemp.txt
echo Encoding=1 >> c:\rstemp.txt
echo PBVersion=1 >> c:\rstemp.txt
echo Type=5  >> c:\rstemp.txt
echo AutoLogon=0 >> c:\rstemp.txt
echo UseRasCredentials=0 >> c:\rstemp.txt
echo LowDateTime=-582619296 >> c:\rstemp.txt
echo HighDateTime=30327625 >> c:\rstemp.txt
echo DialParamsUID=6326979 >> c:\rstemp.txt
echo Guid=359A05BF4C146640949F56383A0F18F5 >> c:\rstemp.txt
echo VpnStrategy=0 >> c:\rstemp.txt
echo ExcludedProtocols=0 >> c:\rstemp.txt
echo LcpExtensions=1 >> c:\rstemp.txt
echo DataEncryption=8 >> c:\rstemp.txt
echo SwCompression=0 >> c:\rstemp.txt
echo NegotiateMultilinkAlways=0 >> c:\rstemp.txt
echo SkipDoubleDialDialog=0 >> c:\rstemp.txt
echo DialMode=0 >> c:\rstemp.txt
echo OverridePref=15 >> c:\rstemp.txt
echo RedialAttempts=3 >> c:\rstemp.txt
echo RedialSeconds=60 >> c:\rstemp.txt
echo IdleDisconnectSeconds=0 >> c:\rstemp.txt
echo RedialOnLinkFailure=1 >> c:\rstemp.txt
echo CallbackMode=0 >> c:\rstemp.txt
echo CustomDialDll= >> c:\rstemp.txt
echo CustomDialFunc= >> c:\rstemp.txt
echo CustomRasDialDll= >> c:\rstemp.txt
echo ForceSecureCompartment=0 >> c:\rstemp.txt
echo DisableIKENameEkuCheck=0 >> c:\rstemp.txt
echo AuthenticateServer=0 >> c:\rstemp.txt
echo ShareMsFilePrint=0 >> c:\rstemp.txt
echo BindMsNetClient=0 >> c:\rstemp.txt
echo SharedPhoneNumbers=0 >> c:\rstemp.txt
echo GlobalDeviceSettings=0 >> c:\rstemp.txt
echo PrerequisiteEntry= >> c:\rstemp.txt
echo PrerequisitePbk= >> c:\rstemp.txt
echo PreferredPort=PPPoE4-0 >> c:\rstemp.txt
echo PreferredDevice=WAN Miniport (PPPOE) >> c:\rstemp.txt
echo PreferredBps=0 >> c:\rstemp.txt
echo PreferredHwFlow=0 >> c:\rstemp.txt
echo PreferredProtocol=0 >> c:\rstemp.txt
echo PreferredCompression=0 >> c:\rstemp.txt
echo PreferredSpeaker=0 >> c:\rstemp.txt
echo PreferredMdmProtocol=0 >> c:\rstemp.txt
echo PreviewUserPw=1 >> c:\rstemp.txt
echo PreviewDomain=0 >> c:\rstemp.txt
echo PreviewPhoneNumber=0 >> c:\rstemp.txt
echo ShowDialingProgress=1 >> c:\rstemp.txt
echo ShowMonitorIconInTaskBar=1 >> c:\rstemp.txt
echo CustomAuthKey=0 >> c:\rstemp.txt
echo AuthRestrictions=552 >> c:\rstemp.txt
echo IpPrioritizeRemote=1 >> c:\rstemp.txt
echo IpInterfaceMetric=0 >> c:\rstemp.txt
echo IpHeaderCompression=0 >> c:\rstemp.txt
echo IpAddress=0.0.0.0 >> c:\rstemp.txt
echo IpDnsAddress=0.0.0.0 >> c:\rstemp.txt
echo IpDns2Address=0.0.0.0 >> c:\rstemp.txt
echo IpWinsAddress=0.0.0.0 >> c:\rstemp.txt
echo IpWins2Address=0.0.0.0 >> c:\rstemp.txt
echo IpAssign=1 >> c:\rstemp.txt
echo IpNameAssign=1 >> c:\rstemp.txt
echo IpDnsFlags=0 >> c:\rstemp.txt
echo IpNBTFlags=0 >> c:\rstemp.txt
echo TcpWindowSize=0 >> c:\rstemp.txt
echo UseFlags=3 >> c:\rstemp.txt
echo IpSecFlags=0 >> c:\rstemp.txt
echo IpDnsSuffix= >> c:\rstemp.txt
echo Ipv6Assign=1 >> c:\rstemp.txt
echo Ipv6Address=:: >> c:\rstemp.txt
echo Ipv6PrefixLength=0 >> c:\rstemp.txt
echo Ipv6PrioritizeRemote=1 >> c:\rstemp.txt
echo Ipv6InterfaceMetric=0 >> c:\rstemp.txt
echo Ipv6NameAssign=1 >> c:\rstemp.txt
echo Ipv6DnsAddress=:: >> c:\rstemp.txt
echo Ipv6Dns2Address=:: >> c:\rstemp.txt
echo Ipv6Prefix=0000000000000000 >> c:\rstemp.txt
echo Ipv6InterfaceId=0000000000000000 >> c:\rstemp.txt
echo DisableClassBasedDefaultRoute=0 >> c:\rstemp.txt
echo DisableMobility=0 >> c:\rstemp.txt
echo NetworkOutageTime=0 >> c:\rstemp.txt
echo ProvisionType=0 >> c:\rstemp.txt
echo PreSharedKey= >> c:\rstemp.txt

echo NETCOMPONENTS= >> c:\rstemp.txt
echo ms_msclient=0 >> c:\rstemp.txt
echo ms_server=0 >> c:\rstemp.txt

echo MEDIA=rastapi >> c:\rstemp.txt
echo Port=PPPoE4-0 >> c:\rstemp.txt
echo Device=WAN Miniport (PPPOE) >> c:\rstemp.txt

echo DEVICE=PPPoE >> c:\rstemp.txt
echo LastSelectedPhone=0 >> c:\rstemp.txt
echo PromoteAlternates=0 >> c:\rstemp.txt
echo TryNextAlternateOnFail=1 >> c:\rstemp.txt

rem ### Removing white spaces so that it can be readable by phone book /zaib
rem echo. 2>  c:\rscompile.bat
rem if [%1]==[] then echo File name missing & goto :EOF >>
(for /f "tokens=1" %%a in (rstemp.txt) do echo %%a) > %~n1aa-rasphone.pbk

rem ### Location for rasphone.pbk [just for reference] /zaib
rem %userprofile%\AppData\Roaming\Microsoft\Network\Connections\Pbk\

rem ### Creating Network Profile Folder to store dialer profile, if its not there already
mkdir %userprofile%\AppData\Roaming\Microsoft\Network
mkdir %userprofile%\AppData\Roaming\Microsoft\Network\Connections
mkdir %userprofile%\AppData\Roaming\Microsoft\Network\Connections\pbk
cls
rem Copy new rasphone.pbk to user network profile /zaib
rem cd %userprofile%\AppData\Roaming\Microsoft\Network\Connections\Pbk\
rem ren rasphone.pbk rasphone.pbk.old
copy c:\aa-rasphone.pbk %userprofile%\AppData\Roaming\Microsoft\Network\Connections\Pbk\

rem ### Create Network Connection Center Icon on Desktop /zaib
rem ### I coulnd't found a way to create shortcut of dialer on desktop, someone please suggest
set linkName=AA-Network Connections
set linkPath=%userprofile%\desktop
set program=C:\WINDOWS\SYSTEM32\ncpa.cpl
set workDir=C:\WINDOWS\system32
set iconfile=%SystemRoot%\system32\SHELL32.dll
set icon=-18
set windowStyle=2
echo Set oWS = WScript.CreateObject("WScript.Shell") > temp.vbs
echo sLinkFile = "%linkPath%\%linkName%.LNK" >> temp.vbs
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> temp.vbs
echo oLink.TargetPath = "%program%" >> temp.vbs
echo oLink.IconLocation = "%iconFile%, %icon%" >> temp.vbs
echo oLink.WindowStyle = "%windowStyle%" >> temp.vbs
echo oLink.WorkingDirectory = "%workdir%" >> temp.vbs
echo oLink.Save >> temp.vbs

WScript.exe temp.vbs
del temp.vbs

rem #
rem ### Show Popup Message box after everything completed /zaib
rem #

mshta javascript:alert("Dialer Installation Completed!!!\n\Please Restart you computern ,Thank You\n\Syed.Jahanzaib! aacable@hotmail.com");close();

rem # THE END #

Now execute it from c:\dialer.bat & then restart your computer. If you dont want to restart the newly created connection will not show in network connections, You have to press F5 in the network connections to display the newly created profile. After restart it will appear auto in network and sharing center.

After successful lab testing, its time to make it a distributable package. To convert it in executable package, you download BATCH to EXE converter.


http://www.f2ko.de/downloads/Bat_To_Exe_Converter.zip

extract and run Bat_To_Exe_Converter.exe

Fill up the required info as shown in teh images below and click on compile.

1- compile

and click on COMPILE , it will create .exe Package. You can also add additional info like ICON file , or product version or info

As showed in the image below . .

2- compile

.

.

End results 🙂

3- info

Regard’s
Syed Jahanzaib

Advertisements

3 Comments »

  1. but i am add name isp and full configration
    user only add name user and password
    how ?

    Like

    Comment by zoro — November 8, 2013 @ 2:38 PM

  2. line 123 copy c:\aa-rasphone.pbk %userprofile%\AppData\Roaming\Microsoft\Network\Connections\Pbk\
    does not work on windows 8

    Like

    Comment by iesien22 — September 10, 2014 @ 7:42 AM


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: