none
Conexão PPPoE RRS feed

  • Pergunta

  • Estou criando um batch script que efetua a discagem de uma conexão PPPoE. Até então muito simples, o rasdial faz todo o trabalho. O problema é que apesar de muito pesquisar no Grande Oráculo (leia-se Google) não consegui encontrar nada referente a criação de uma conexão PPPoE através de linha de comando. A questão então é a seguinte: como criar através de linha de comando uma nova conexão PPPoE. Aguardo resposta e agradeço desde já ;)
    quinta-feira, 18 de junho de 2009 20:17

Respostas

  • Kabbalista,

    Nao poderia ser por VB?

    Option Explicit
    
    Private Declare Function RegCreateKey Lib "advapi32.dll" Alias _
    "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, 
    phkResult As Long) As Long
    
    Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias _
    "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    
    Private Declare Function RegCloseKey Lib "advapi32.dll" _
    (ByVal hKey As Long) As Long
    
    Private Declare Function SQLDataSources% Lib "ODBC32.DLL" (ByVal henv&, ByVal fdir%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDesc$, ByVal cbDescMax%, pcbDesc%)
    
    Private Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)
    
    Const SQL_SUCCESS As Long = 0
    Const SQL_FETCH_NEXT As Long = 1
    
    ====================================
    then i have a function called create_DSN:
    ====================================
    
    Public Function create_DSN(DataSourceName As String, DatabaseName As String, Description As String, _ DriverPath As String, DriverName As String, LastUser As String, Server As String)
    
    Dim lResult As Long
    Dim hKeyHandle As Long
    
    'Create the new DSN key.
    lResult = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWAREODBCODBC.INI" & _
    DataSourceName, hKeyHandle)
    
    'Set the values of the new DSN key.
    lResult = RegSetValueEx(hKeyHandle, "Database", 0&, REG_SZ, _
    ByVal DatabaseName, Len(DatabaseName))
    
    lResult = RegSetValueEx(hKeyHandle, "Description", 0&, REG_SZ, ByVal Description, Len(Description))
    
    lResult = RegSetValueEx(hKeyHandle, "Driver", 0&, REG_SZ, _
    ByVal DriverPath, Len(DriverPath))
    
    lResult = RegSetValueEx(hKeyHandle, "LastUser", 0&, REG_SZ, _
    ByVal LastUser, Len(LastUser))
    
    lResult = RegSetValueEx(hKeyHandle, "Server", 0&, REG_SZ, _
    ByVal Server, Len(Server))
    
    'Close the new DSN key.
    lResult = RegCloseKey(hKeyHandle)
    
    'Open ODBC Data Sources key to list the new DSN in the ODBC Manager.
    lResult = RegCreateKey(HKEY_LOCAL_MACHINE, _
    "SOFTWAREODBCODBC.INIODBC Data Sources", hKeyHandle)
    
    'Specify the new value.
    lResult = RegSetValueEx(hKeyHandle, DataSourceName, 0&, REG_SZ, ByVal DriverName, Len(DriverName))
    
    'Close the key.
    lResult = RegCloseKey(hKeyHandle)
    End Function
    
    ===================================



    LINK:http://www.bigresource.com/VB-Creating-a-PPPoE-Dialup-connection-GCXDz1nxA9.html


    Thiago Cardoso Luiz - MCP W2k3 MCTS http://t-cardoso.blogspot.com/ Caso seja util VOTE e COLOQUE COMO RESPOSTA
    • Marcado como Resposta Kabbalista quarta-feira, 1 de julho de 2009 03:18
    segunda-feira, 22 de junho de 2009 21:54
    Moderador

Todas as Respostas

  • Kabbalista,

    Nao poderia ser por VB?

    Option Explicit
    
    Private Declare Function RegCreateKey Lib "advapi32.dll" Alias _
    "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, 
    phkResult As Long) As Long
    
    Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias _
    "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
    
    Private Declare Function RegCloseKey Lib "advapi32.dll" _
    (ByVal hKey As Long) As Long
    
    Private Declare Function SQLDataSources% Lib "ODBC32.DLL" (ByVal henv&, ByVal fdir%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDesc$, ByVal cbDescMax%, pcbDesc%)
    
    Private Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)
    
    Const SQL_SUCCESS As Long = 0
    Const SQL_FETCH_NEXT As Long = 1
    
    ====================================
    then i have a function called create_DSN:
    ====================================
    
    Public Function create_DSN(DataSourceName As String, DatabaseName As String, Description As String, _ DriverPath As String, DriverName As String, LastUser As String, Server As String)
    
    Dim lResult As Long
    Dim hKeyHandle As Long
    
    'Create the new DSN key.
    lResult = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWAREODBCODBC.INI" & _
    DataSourceName, hKeyHandle)
    
    'Set the values of the new DSN key.
    lResult = RegSetValueEx(hKeyHandle, "Database", 0&, REG_SZ, _
    ByVal DatabaseName, Len(DatabaseName))
    
    lResult = RegSetValueEx(hKeyHandle, "Description", 0&, REG_SZ, ByVal Description, Len(Description))
    
    lResult = RegSetValueEx(hKeyHandle, "Driver", 0&, REG_SZ, _
    ByVal DriverPath, Len(DriverPath))
    
    lResult = RegSetValueEx(hKeyHandle, "LastUser", 0&, REG_SZ, _
    ByVal LastUser, Len(LastUser))
    
    lResult = RegSetValueEx(hKeyHandle, "Server", 0&, REG_SZ, _
    ByVal Server, Len(Server))
    
    'Close the new DSN key.
    lResult = RegCloseKey(hKeyHandle)
    
    'Open ODBC Data Sources key to list the new DSN in the ODBC Manager.
    lResult = RegCreateKey(HKEY_LOCAL_MACHINE, _
    "SOFTWAREODBCODBC.INIODBC Data Sources", hKeyHandle)
    
    'Specify the new value.
    lResult = RegSetValueEx(hKeyHandle, DataSourceName, 0&, REG_SZ, ByVal DriverName, Len(DriverName))
    
    'Close the key.
    lResult = RegCloseKey(hKeyHandle)
    End Function
    
    ===================================



    LINK:http://www.bigresource.com/VB-Creating-a-PPPoE-Dialup-connection-GCXDz1nxA9.html


    Thiago Cardoso Luiz - MCP W2k3 MCTS http://t-cardoso.blogspot.com/ Caso seja util VOTE e COLOQUE COMO RESPOSTA
    • Marcado como Resposta Kabbalista quarta-feira, 1 de julho de 2009 03:18
    segunda-feira, 22 de junho de 2009 21:54
    Moderador
  • Por VB serve. Assim posso usa-lo como um script VBS. Ótima idéia, muito obrigado!
    quarta-feira, 1 de julho de 2009 03:18
  • Ola, amado! Voce conseguiu fazer o discador pppoe em VB? Podemos conversar?

    damonetx@hotmail.com

    domingo, 16 de outubro de 2011 17:47