Jump to content

VPN Automation


mistrfree
 Share

Recommended Posts

Not sure how to exactly post this code, but here goes. This is just a script that I made to make it easier for a few of the people at the office to get into our VPN server. They seem to have problems, so I automated it for them. This is in the end an exe file with an installer. It actually gives them the ability to connect to our server, access their drives, connect to our main database server, check their email, pretty easily. The addresses are zeroed out for security. Maybe someone can use it and modify it to their taste.

#Region --- CodeWizard generated code Start ---

#include <Constants.au3>

;SpashImage features: Title=Yes, Width=330, Height=141, Left=5, Top=5, Windows can be moved

SplashImageOn("Waldrop HVAC VPN Connection Manager","VPN1.bmp","330","141","115","2",$DLG_NOTONTOP + 16)

#EndRegion --- CodeWizard generated code End ---

#include <GUIConstants.au3>

#include <Inet.au3>

#include "rasphone.pbk"

Global $File = "reg.ini"

Global $Section = "Registration"

Global $Key = "User"

Global $Key2 = "Pass"

Global $Key3 = "Size"

Global $Key4 = "Date"

Global $user = IniRead ($File,$Section,$Key, "Key not Found")

Global $pass = IniRead ($File,$Section,$Key2, "Key not Found")

;--------Registration Check---------

If FileExists($File) Then

Check()

Else

Fail()

EndIf

;--------End Registration Check--------

Global $XP = "WIN32_NT"

Global $NT = " "

Global $OS = @OSTYPE

Global $gui_width = 300

Global $gui_height = 550

Global $gui_child_height = $gui_height - 22

; -----This is the Main Window----

Global $main_GUI = GUICreate("Waldrop HVAC VPN Connection Manager",$gui_width,$gui_height,450,-2,BitOr($GUI_SS_DEFAULT_GUI,$WS_CLIPSIBLINGS))

Global $support_button = GUICtrlCreateButton("Support",$gui_width - 240,$gui_height - 20,70,20)

Global $close_button = GUICtrlCreateButton("Close",$gui_width - 120,$gui_height - 20,70,20)

GUISetState()

; ----This is the Child Window----

GUICtrlSetColor(-1,0xFFFFFF)

Global $child_GUI = GUICreate("",$gui_width,$gui_child_height,0,0,$WS_CHILD,-1,$main_GUI)

Global $child_title = GUICtrlCreateLabel("WALDROP HVAC VPN",0,5,$gui_width,20,$SS_CENTER)

GUICtrlSetFont(-1,10,600)

Global $child_about_button = GUICtrlCreateButton("My Documents",($gui_width - 80) / 2,$gui_child_height - 235,90,20)

GUISetState()

;---Start Main Window Labeling-----

$Label = GUICtrlCreateLabel("", 10, 10)

$Label = GUICtrlCreateLabel("", 10, 25)

$Label = GUICtrlCreateLabel(" All activity on Waldrop HVAC VPN server is logged and", 10, 40)

$Label = GUICtrlCreateLabel(" monitored. Any abuse will result in IMMEDIATE termina-", 10, 55)

$Label = GUICtrlCreateLabel(" tion of your access priviledges. All users are required", 10, 70)

$Label = GUICtrlCreateLabel(" to have adequate Anit-Virus protection installed on their", 10, 85)

$Label = GUICtrlCreateLabel(" systems prior to logging in.", 10, 100)

$Label = GUICtrlCreateLabel("", 10, 115)

$Label = GUICtrlCreateLabel("Start connection to Waldrop HVAC VPN server by clicking", 10, 130)

$Label = GUICtrlCreateLabel(" the CONNECT button. ", 10, 145)

$Label = GUICtrlCreateLabel("", 10, 160)

$CONNECT = GUICtrlCreateButton("*CONNECT*", 110, 175, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 190)

$Label = GUICtrlCreateLabel("*Please Ensure That You Are Connected To Waldrop VPN*", 10, 205)

$Label = GUICtrlCreateLabel("************Server Before Proceeding Any Further************", 10, 220)

$Label = GUICtrlCreateLabel("", 10, 235)

$Label = GUICtrlCreateLabel("**********************************************************************", 10, 240)

$Label = GUICtrlCreateLabel(" Click here to connect to your documents located at the ", 10, 255)

$Label = GUICtrlCreateLabel(" office. This will map your drives to your home computer.", 10, 270)

$Label = GUICtrlCreateLabel("", 10, 280)

$Label = GUICtrlCreateLabel("", 10, 295)

$Label = GUICtrlCreateLabel("**********************************************************************", 10, 320)

$Label = GUICtrlCreateLabel("If you have your TMS login and password you can choose", 10, 335)

$Label = GUICtrlCreateLabel("to connect to TMS.", 10, 350)

$TMS = GUICtrlCreateButton("Connect to TMS", 110, 365, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 380)

$Label = GUICtrlCreateLabel("**********************************************************************", 10, 390)

$Label = GUICtrlCreateLabel(" You can access your office Internet email using Internet", 10, 400)

$Label = GUICtrlCreateLabel(" Explorer at this time. ", 10, 415)

$Label = GUICtrlCreateLabel("", 10, 430)

$Label = GUICtrlCreateLabel(" ", 10, 445)

$Label = GUICtrlCreateLabel(" ", 10, 460)

$Label = GUICtrlCreateLabel(" .", 10, 475)

$EMAIL = GUICtrlCreateButton("Email Access", 110, 490, 90, 20)

$Label = GUICtrlCreateLabel("*********************************************************************", 10, 515)

;----End Main Window Labeling-------

;------Start MyDocument Labeling-----

Global $about_GUI = GUICreate("",$gui_width,$gui_child_height,0,0,$WS_CHILD,-1,$main_GUI)

Global $about_title = GUICtrlCreateLabel("My Documents",0,5,$gui_width,20,$SS_CENTER)

GUICtrlSetFont(-1,10,600)

Global $about_label = GUICtrlCreateLabel("This section will map your office drives to your home computer. Selecting your username will begin the process. Your newly mapped drives will open in a new window/s. If your user directory is located in the Public Share directory, select your user's directory folder to access your documents. The process works in the same fashion for user's private share directories. Private shares are ONLY accessible by the authorized user.",15,30,$gui_width - 30,240)

GUICtrlSetFont(-1,10)

$Label = GUICtrlCreateLabel("", 10, 250)

$Lynne = GUICtrlCreateButton("Lynne W.", 20, 265, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 280)

$Angie = GUICtrlCreateButton("Angie M.", 20, 295, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 310)

$Jason = GUICtrlCreateButton("Jason S.", 20, 325, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 340)

$Samantha = GUICtrlCreateButton("Samantha P.", 20, 355, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 370)

$Bill = GUICtrlCreateButton("Bill C.", 20, 385, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 250)

$Dennis = GUICtrlCreateButton("Dennis P.", 180, 265, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 280)

$Jimmy = GUICtrlCreateButton("Jimmy C.", 180, 295, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 310)

$Terri = GUICtrlCreateButton("Terri T.", 180, 325, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 340)

$Terry = GUICtrlCreateButton("Terry K.", 180, 355, 90, 20)

$Label = GUICtrlCreateLabel("", 10, 370)

$Jamie = GUICtrlCreateButton("Jamie P.", 180, 385, 90, 20)

Global $about_prefs_button = GUICtrlCreateButton("Back",($gui_width - 60) / 2,$gui_child_height - 30,70,20)

;----End MyDocument Labeling-------

While 1

$msg = GUIGetMsg(1)

Select

Case $msg[0] = $GUI_EVENT_CLOSE Or $msg[0] = $close_button

MsgBox(0, "Closing Waldrop VPN", "This will now close the Waldrop VPN Connection...")

DriveMapDel("Q:")

DriveMapDel("R:")

SHUT()

Run("rasdial.exe /disconnect")

ExitLoop

Case $msg[0] = $support_button

_INetMail("kelly@kellyedwards.com", "Regarding " & "Waldrop VPN Support", "")

Case $msg[0] = $child_about_button

GUISetState(@SW_HIDE,$child_GUI)

GUISetState(@SW_SHOW,$about_GUI)

Case $msg[0] = $about_prefs_button

GUISetState(@SW_HIDE,$about_GUI)

GUISetState(@SW_SHOW,$child_GUI)

Case $msg[0] = $CONNECT

If @OSTYPE = $XP Then

CONNECT2()

Else

CONNECT1()

EndIf

Case $msg[0] = $TMS

Run("TMS.EXE")

Case $msg[0] = $EMAIL

Run ( @ComSpec & " /c start http://0.0.0.0", "", @SW_HIDE )

Case $msg[0] = $Bill

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

DriveMapAdd("R:", "\\0.0.0.0\Bill", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Run("explorer.exe R:\")

Case $msg[0] = $Lynne

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

DriveMapAdd("R:", "\\0.0.0.0\Lynne", 0, $user, $pass)

DriveMapAdd("S:", "\\0.0.0.0\MyDocument", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Run("explorer.exe R:\")

Case $msg[0] = $Angie

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

DriveMapAdd("R:", "\\0.0.0.0\MyDocument", 0, $user, $pass)

DriveMapAdd("S:", "\\0.0.0.0\Lynne", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Run("explorer.exe R:\")

Case $msg[0] = $Jason

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Case $msg[0] = $Samantha

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Case $msg[0] = $Jamie

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Case $msg[0] = $Dennis

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Case $msg[0] = $Jimmy

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Case $msg[0] = $Terri

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

Case $msg[0] = $Terry

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)

PROGRESS()

Run("explorer.exe Q:\")

EndSelect

WEnd

;--Lists of Functions in script----

Func Check()

$Size = IniRead ($File,$Section,$Key3, "Key not Found")

$Date = IniRead ($File,$Section,$Key4, "Key not Found")

$Reg = FileGetSize($File)

$DateStamp = FileGetTime($File, 0)

$yyyymd = $DateStamp[0] & "/" & $DateStamp[1] & "/" & $DateStamp[2]

If $Reg = $Size And $Date = $yyyymd Then

Else

FAIL()

EndIf

EndFunc

Func FAIL()

MsgBox(0, "UN-AUTHORIZED USER", "Your license file is corrupt or missing. Please contact Waldrop Heating and Air Conditioning Inc. for licensing help or authorization to use this software. http://www.waldrophvac.com")

EXIT

EndFunc

Func SHUT()

ProgressOn("Shutting Down Waldrop VPN", "Closing Connections...", "0 percent")

For $i = 10 to 100 step 33

sleep(1000)

ProgressSet( $i, $i & " percent")

Next

ProgressSet(100 , "Done", "Complete")

sleep(500)

ProgressOff()

EndFunc

Func CONNECT2()

If FileExists(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk') Then

Run(@ComSpec & ' /c ' & FileGetShortName(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'), '', @SW_HIDE)

Else

If FileExists(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk') Then

FileInstall("rasphone.pbk", (@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'))

POST2()

Else

DirCreate(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk')

POST()

EndIf

EndIf

EndFunc

Func POST()

FileInstall("rasphone.pbk", (@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'))

Run(@ComSpec & ' /c ' & FileGetShortName(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'), '', @SW_HIDE)

EndFunc

Func POST2()

Run(@ComSpec & ' /c ' & FileGetShortName(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'), '', @SW_HIDE)

EndFunc

Func CONNECT1()

If FileExists(@SystemDir & '\ras\rasphone.pbk') Then

Run(@ComSpec & ' /c ' & FileGetShortName(@SystemDir & '\ras\rasphone.pbk'), '', @SW_HIDE)

Else

If FileExists(@SystemDir & '\ras') Then

FileInstall("rasphone.pbk", (@SystemDir & '\ras'))

POST3()

Else

DirCreate(@SystemDir & '\ras')

POST4()

EndIf

EndIf

EndFunc

Func POST3()

FileInstall("rasphone.pbk", (@SystemDir & '\ras'))

Run(@ComSpec & ' /c ' & FileGetShortName(@SystemDir & '\ras\rasphone.pbk'), '', @SW_HIDE)

EndFunc

Func POST4()

Run(@ComSpec & ' /c ' & FileGetShortName(@SystemDir & '\ras\rasphone.pbk'), '', @SW_HIDE)

EndFunc

Func PROGRESS()

ProgressOn("Progress Meter", "Mapping Drives...", "0 percent")

For $i = 10 to 100 step 12

sleep(1000)

ProgressSet( $i, $i & " percent")

Next

ProgressSet(100 , "Done", "Complete")

sleep(500)

ProgressOff()

EndFunc

Link to comment
Share on other sites

  • 5 months later...

I'm trying to setup a VPN connection with this script and I come up with this error:

Line 1 (File "C:\Users\Administrator\Desktop\rasphone.pbk");

[Jonathans Server WAN]

[^ERROR

Error Unknown function name.

Here is the contents of VPN script file.

#Region --- CodeWizard generated code Start ---
#include <Constants.au3>
;SpashImage features: Title=Yes, Width=330, Height=141, Left=5, Top=5, Windows can be moved
SplashImageOn("Waldrop HVAC VPN Connection Manager","VPN1.bmp","330","141","115","2",$DLG_NOTONTOP + 16)
#EndRegion --- CodeWizard generated code End ---
#include <GUIConstants.au3>
#include <Inet.au3>
#include "rasphone.pbk"
Global $File = "reg.ini"
Global $Section = "Registration"
Global $Key = "User"
Global $Key2 = "Pass"
Global $Key3 = "Size"
Global $Key4 = "Date"
Global $user = IniRead ($File,$Section,$Key, "Key not Found")
Global $pass = IniRead ($File,$Section,$Key2, "Key not Found")
;--------Registration Check---------
If FileExists($File) Then
Check() 
Else
Fail()
EndIf
;--------End Registration Check--------
Global $XP = "WIN32_NT"
Global $NT = " "
Global $OS = @OSTYPE
Global $gui_width = 300
Global $gui_height = 550
Global $gui_child_height = $gui_height - 22
; -----This is the Main Window----
Global $main_GUI = GUICreate("Waldrop HVAC VPN Connection Manager",$gui_width,$gui_height,450,-2,BitOr($GUI_SS_DEFAULT_GUI,$WS_CLIPSIBLINGS))
Global $support_button = GUICtrlCreateButton("Support",$gui_width - 240,$gui_height - 20,70,20)
Global $close_button = GUICtrlCreateButton("Close",$gui_width - 120,$gui_height - 20,70,20)
GUISetState()

; ----This is the Child Window----
GUICtrlSetColor(-1,0xFFFFFF)
Global $child_GUI = GUICreate("",$gui_width,$gui_child_height,0,0,$WS_CHILD,-1,$main_GUI)
Global $child_title = GUICtrlCreateLabel("WALDROP HVAC VPN",0,5,$gui_width,20,$SS_CENTER)
GUICtrlSetFont(-1,10,600)
Global $child_about_button = GUICtrlCreateButton("My Documents",($gui_width - 80) / 2,$gui_child_height - 235,90,20)
GUISetState()
;---Start Main Window Labeling-----
$Label = GUICtrlCreateLabel("", 10, 10)
$Label = GUICtrlCreateLabel("", 10, 25)
$Label = GUICtrlCreateLabel(" All activity on Waldrop HVAC VPN server is logged and", 10, 40)
$Label = GUICtrlCreateLabel(" monitored. Any abuse will result in IMMEDIATE termina-", 10, 55)
$Label = GUICtrlCreateLabel(" tion of your access priviledges. All users are required", 10, 70)
$Label = GUICtrlCreateLabel(" to have adequate Anit-Virus protection installed on their", 10, 85)
$Label = GUICtrlCreateLabel(" systems prior to logging in.", 10, 100)
$Label = GUICtrlCreateLabel("", 10, 115)
$Label = GUICtrlCreateLabel("Start connection to Waldrop HVAC VPN server by clicking", 10, 130)
$Label = GUICtrlCreateLabel(" the CONNECT button. ", 10, 145)
$Label = GUICtrlCreateLabel("", 10, 160)
$CONNECT = GUICtrlCreateButton("*CONNECT*", 110, 175, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 190)
$Label = GUICtrlCreateLabel("*Please Ensure That You Are Connected To Waldrop VPN*", 10, 205)
$Label = GUICtrlCreateLabel("************Server Before Proceeding Any Further************", 10, 220)
$Label = GUICtrlCreateLabel("", 10, 235)
$Label = GUICtrlCreateLabel("**********************************************************************", 10, 240)
$Label = GUICtrlCreateLabel(" Click here to connect to your documents located at the ", 10, 255)
$Label = GUICtrlCreateLabel(" office. This will map your drives to your home computer.", 10, 270)
$Label = GUICtrlCreateLabel("", 10, 280)
$Label = GUICtrlCreateLabel("", 10, 295)
$Label = GUICtrlCreateLabel("**********************************************************************", 10, 320)
$Label = GUICtrlCreateLabel("If you have your TMS login and password you can choose", 10, 335)
$Label = GUICtrlCreateLabel("to connect to TMS.", 10, 350)
$TMS = GUICtrlCreateButton("Connect to TMS", 110, 365, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 380)
$Label = GUICtrlCreateLabel("**********************************************************************", 10, 390)

$Label = GUICtrlCreateLabel(" You can access your office Internet email using Internet", 10, 400)
$Label = GUICtrlCreateLabel(" Explorer at this time. ", 10, 415)
$Label = GUICtrlCreateLabel("", 10, 430)
$Label = GUICtrlCreateLabel(" ", 10, 445)
$Label = GUICtrlCreateLabel(" ", 10, 460)
$Label = GUICtrlCreateLabel(" .", 10, 475)
$EMAIL = GUICtrlCreateButton("Email Access", 110, 490, 90, 20)
$Label = GUICtrlCreateLabel("*********************************************************************", 10, 515)

;----End Main Window Labeling-------

;------Start MyDocument Labeling-----
Global $about_GUI = GUICreate("",$gui_width,$gui_child_height,0,0,$WS_CHILD,-1,$main_GUI)
Global $about_title = GUICtrlCreateLabel("My Documents",0,5,$gui_width,20,$SS_CENTER)
GUICtrlSetFont(-1,10,600)
Global $about_label = GUICtrlCreateLabel("This section will map your office drives to your home computer. Selecting your username will begin the process. Your newly mapped drives will open in a new window/s. If your user directory is located in the Public Share directory, select your user's directory folder to access your documents. The process works in the same fashion for user's private share directories. Private shares are ONLY accessible by the authorized user.",15,30,$gui_width - 30,240)
GUICtrlSetFont(-1,10)
$Label = GUICtrlCreateLabel("", 10, 250)
$Lynne = GUICtrlCreateButton("Lynne W.", 20, 265, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 280)
$Angie = GUICtrlCreateButton("Angie M.", 20, 295, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 310)
$Jason = GUICtrlCreateButton("Jason S.", 20, 325, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 340)
$Samantha = GUICtrlCreateButton("Samantha P.", 20, 355, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 370)
$Bill = GUICtrlCreateButton("Bill C.", 20, 385, 90, 20)


$Label = GUICtrlCreateLabel("", 10, 250)
$Dennis = GUICtrlCreateButton("Dennis P.", 180, 265, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 280)
$Jimmy = GUICtrlCreateButton("Jimmy C.", 180, 295, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 310)
$Terri = GUICtrlCreateButton("Terri T.", 180, 325, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 340)
$Terry = GUICtrlCreateButton("Terry K.", 180, 355, 90, 20)
$Label = GUICtrlCreateLabel("", 10, 370)
$Jamie = GUICtrlCreateButton("Jamie P.", 180, 385, 90, 20)


Global $about_prefs_button = GUICtrlCreateButton("Back",($gui_width - 60) / 2,$gui_child_height - 30,70,20)

;----End MyDocument Labeling-------




While 1 
$msg = GUIGetMsg(1)
Select
Case $msg[0] = $GUI_EVENT_CLOSE Or $msg[0] = $close_button
MsgBox(0, "Closing Waldrop VPN", "This will now close the Waldrop VPN Connection...")
DriveMapDel("Q:")
DriveMapDel("R:")
SHUT()
Run("rasdial.exe /disconnect")
ExitLoop


Case $msg[0] = $support_button
_INetMail("kelly@kellyedwards.com", "Regarding " & "Waldrop VPN Support", "")


Case $msg[0] = $child_about_button
GUISetState(@SW_HIDE,$child_GUI)
GUISetState(@SW_SHOW,$about_GUI)

Case $msg[0] = $about_prefs_button
GUISetState(@SW_HIDE,$about_GUI)
GUISetState(@SW_SHOW,$child_GUI)


Case $msg[0] = $CONNECT
If @OSTYPE = $XP Then
CONNECT2()
Else
CONNECT1()
EndIf 


Case $msg[0] = $TMS
Run("TMS.EXE")

Case $msg[0] = $EMAIL
Run ( @ComSpec & " /c start http://0.0.0.0", "", @SW_HIDE )

Case $msg[0] = $Bill

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
DriveMapAdd("R:", "\\0.0.0.0\Bill", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")
Run("explorer.exe R:\")

Case $msg[0] = $Lynne

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
DriveMapAdd("R:", "\\0.0.0.0\Lynne", 0, $user, $pass)
DriveMapAdd("S:", "\\0.0.0.0\MyDocument", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")
Run("explorer.exe R:\")

Case $msg[0] = $Angie

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
DriveMapAdd("R:", "\\0.0.0.0\MyDocument", 0, $user, $pass)
DriveMapAdd("S:", "\\0.0.0.0\Lynne", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")
Run("explorer.exe R:\")

Case $msg[0] = $Jason

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")

Case $msg[0] = $Samantha

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")

Case $msg[0] = $Jamie

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")

Case $msg[0] = $Dennis

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")

Case $msg[0] = $Jimmy

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")

Case $msg[0] = $Terri

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")

Case $msg[0] = $Terry

DriveMapAdd("Q:", "\\0.0.0.0\system", 0, $user, $pass)
PROGRESS()
Run("explorer.exe Q:\")




EndSelect
WEnd
;--Lists of Functions in script----

Func Check()
$Size = IniRead ($File,$Section,$Key3, "Key not Found")
$Date = IniRead ($File,$Section,$Key4, "Key not Found")
$Reg = FileGetSize($File)
$DateStamp = FileGetTime($File, 0)
$yyyymd = $DateStamp[0] & "/" & $DateStamp[1] & "/" & $DateStamp[2]
If $Reg = $Size And $Date = $yyyymd Then
Else

EndIf
EndFunc

Func FAIL()
MsgBox(0, "UN-AUTHORIZED USER ", "Your license file is corrupt or missing. Please contact Waldrop Heating and Air Conditioning Inc. for licensing help or authorization to use this software. http://www.waldrophvac.com")
EXIT
EndFunc

Func SHUT()
ProgressOn("Shutting Down Waldrop VPN", "Closing Connections...", "0 percent")
For $i = 10 to 100 step 33
sleep(1000)
ProgressSet( $i, $i & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
EndFunc



Func CONNECT2()
If FileExists(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk') Then
Run(@ComSpec & ' /c ' & FileGetShortName(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'), '', @SW_HIDE)
Else
If FileExists(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk') Then
FileInstall("rasphone.pbk", (@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'))
POST2()
Else
DirCreate(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk')
POST()
EndIf
EndIf
EndFunc


Func POST()
FileInstall("rasphone.pbk", (@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'))
Run(@ComSpec & ' /c ' & FileGetShortName(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'), '', @SW_HIDE)
EndFunc


Func POST2()
Run(@ComSpec & ' /c ' & FileGetShortName(@AppDataCommonDir & '\Microsoft\Network\Connections\Pbk\rasphone.pbk'), '', @SW_HIDE)
EndFunc



Func CONNECT1()
If FileExists(@SystemDir & '\ras\rasphone.pbk') Then
Run(@ComSpec & ' /c ' & FileGetShortName(@SystemDir & '\ras\rasphone.pbk'), '', @SW_HIDE)
Else
If FileExists(@SystemDir & '\ras') Then
FileInstall("rasphone.pbk", (@SystemDir & '\ras'))
POST3()
Else
DirCreate(@SystemDir & '\ras')
POST4()
EndIf
EndIf
EndFunc


Func POST3()
FileInstall("rasphone.pbk", (@SystemDir & '\ras'))
Run(@ComSpec & ' /c ' & FileGetShortName(@SystemDir & '\ras\rasphone.pbk'), '', @SW_HIDE)
EndFunc


Func POST4()
Run(@ComSpec & ' /c ' & FileGetShortName(@SystemDir & '\ras\rasphone.pbk'), '', @SW_HIDE)
EndFunc




Func PROGRESS()
ProgressOn("Progress Meter", "Mapping Drives...", "0 percent")
For $i = 10 to 100 step 12
sleep(1000)
ProgressSet( $i, $i & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
EndFunc

Here is the contents of rasphone.pbk

[Jonathans Server WAN]
Encoding=1
Type=2
AutoLogon=0
UseRasCredentials=1
LowDateTime=1378578976
HighDateTime=29744419
DialParamsUID=3315312
Guid=74104476CF14E94C8EA2CD668C9F5FD7
BaseProtocol=1
VpnStrategy=2
ExcludedProtocols=0
LcpExtensions=1
DataEncryption=256
SwCompression=0
NegotiateMultilinkAlways=0
SkipNwcWarning=0
SkipDownLevelDialog=0
SkipDoubleDialDialog=0
DialMode=1
OverridePref=15
RedialAttempts=3
RedialSeconds=60
IdleDisconnectSeconds=0
RedialOnLinkFailure=1
CallbackMode=0
CustomDialDll=
CustomDialFunc=
CustomRasDialDll=
AuthenticateServer=0
ShareMsFilePrint=1
BindMsNetClient=1
SharedPhoneNumbers=0
GlobalDeviceSettings=0
PrerequisiteEntry=
PrerequisitePbk=
PreferredPort=VPN0-0
PreferredDevice=WAN Miniport (L2TP)
PreferredBps=0
PreferredHwFlow=1
PreferredProtocol=1
PreferredCompression=1
PreferredSpeaker=1
PreferredMdmProtocol=0
PreviewUserPw=1
PreviewDomain=1
PreviewPhoneNumber=0
ShowDialingProgress=1
ShowMonitorIconInTaskBar=1
CustomAuthKey=-1
AuthRestrictions=512
TypicalAuth=2
IpPrioritizeRemote=1
IpHeaderCompression=0
IpAddress=0.0.0.0
IpDnsAddress=0.0.0.0
IpDns2Address=0.0.0.0
IpWinsAddress=0.0.0.0
IpWins2Address=0.0.0.0
IpAssign=1
IpNameAssign=1
IpDnsFlags=1
IpNBTFlags=1
TcpWindowSize=0
UseFlags=0
IpSecFlags=0
IpDnsSuffix=

NETCOMPONENTS=
ms_server=1
ms_msclient=1
ms_pacer=1
cntx_vpcnets2=1

MEDIA=rastapi
Port=VPN0-0
Device=WAN Miniport (L2TP)

DEVICE=vpn
PhoneNumber=linkx.zapto.org
AreaCode=
CountryCode=1
CountryID=1
UseDialingRules=0
Comment=
LastSelectedPhone=0
PromoteAlternates=0
TryNextAlternateOnFail=1

[Jonathans Server LAN]
Encoding=1
Type=2
AutoLogon=0
UseRasCredentials=1
LowDateTime=1009879376
HighDateTime=29817644
DialParamsUID=3913875
Guid=14761DD1EFBA2640A83F904F1484323D
BaseProtocol=1
VpnStrategy=2
ExcludedProtocols=0
LcpExtensions=1
DataEncryption=256
SwCompression=0
NegotiateMultilinkAlways=0
SkipNwcWarning=0
SkipDownLevelDialog=0
SkipDoubleDialDialog=0
DialMode=1
OverridePref=15
RedialAttempts=3
RedialSeconds=60
IdleDisconnectSeconds=0
RedialOnLinkFailure=1
CallbackMode=0
CustomDialDll=
CustomDialFunc=
CustomRasDialDll=
ForceSecureCompartment=0
AuthenticateServer=0
ShareMsFilePrint=1
BindMsNetClient=1
SharedPhoneNumbers=0
GlobalDeviceSettings=0
PrerequisiteEntry=
PrerequisitePbk=
PreferredPort=VPN0-0
PreferredDevice=WAN Miniport (L2TP)
PreferredBps=0
PreferredHwFlow=1
PreferredProtocol=1
PreferredCompression=1
PreferredSpeaker=1
PreferredMdmProtocol=0
PreviewUserPw=1
PreviewDomain=0
PreviewPhoneNumber=0
ShowDialingProgress=1
ShowMonitorIconInTaskBar=1
CustomAuthKey=-1
AuthRestrictions=544
TypicalAuth=2
IpPrioritizeRemote=1
fCachedDnsSuffix=0
IpHeaderCompression=0
IpAddress=0.0.0.0
IpDnsAddress=0.0.0.0
IpDns2Address=0.0.0.0
IpWinsAddress=0.0.0.0
IpWins2Address=0.0.0.0
IpAssign=1
IpNameAssign=1
IpDnsFlags=1
IpNBTFlags=1
TcpWindowSize=0
UseFlags=0
IpSecFlags=0
IpDnsSuffix=
IpCachedDnsSuffix=


NETCOMPONENTS=
ms_server=1
ms_msclient=1
ms_nativewifip=1
ms_pacer=1

MEDIA=rastapi
Port=VPN0-0
Device=WAN Miniport (L2TP)

DEVICE=vpn
PhoneNumber=LINK
AreaCode=
CountryCode=1
CountryID=1
UseDialingRules=0
Comment=
LastSelectedPhone=0
PromoteAlternates=0
TryNextAlternateOnFail=1
Link to comment
Share on other sites

  • 4 weeks later...

I'm really, really hoping they are not real life access details you have posted in a public forum.

The rasphone.pbk is a dummy file. Its used to store phonebook entries, but I want it blank in this instance which will prompt for a new entry. You cannot use a pbk across different systems, they have specific hardware information inside, which will not match up. Depending whether a user has or has not made a connection b4. This allows the user to create a connnedction to the server, and its used and placed for the users system, either XP or 2000.

This is a small version to give some ideas on how to proceeed with it. My final is a bit more complex and user friendly.

Edited by mistrfree
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...