rasphone.pbk is a glorified INI file

I played around with this for a while until I determined that it was easier to copy in the pbk from the server

code:
break on



RASConn("Test",,,1)





Function RASConn($connection,optional $arrayElements,optional $arrayValues, optional $machine)
DIM $pbk,$params,$values,$index

$params="Encoding", "Type", "AutoLogon",
"DialParamsUID", "Guid", "BaseProtocol",
"VpnStrategy", "ExcludedProtocols", "LcpExtensions",
"DataEncryption", "SwCompression", "NegotiateMultilinkAlways",
"SkipNwcWarning", "SkipDownLevelDialog", "SkipDoubleDialDialog",
"DialMode", "DialPercent", "DialSeconds",
"HangUpPercent", "HangUpSeconds", "OverridePref",
"RedialAttempts", "RedialSeconds", "IdleDisconnectSeconds",
"RedialOnLinkFailure", "CallbackMode", "CustomDialDll",
"CustomDialFunc", "CustomRasDialDll", "AuthenticateServer",
"ShareMsFilePrint", "BindMsNetClient", "SharedPhoneNumbers",
"PrerequisiteEntry", "PrerequisitePbk", "PreferredPort",
"PreferredDevice", "PreviewUserPw", "PreviewDomain",
"PreviewPhoneNumber", "ShowDialingProgress", "ShowMonitorIconInTaskBar",
"CustomAuthKey", "AuthRestrictions", "TypicalAuth",
"IpPrioritizeRemote", "IpHeaderCompression", "IpAddress",
"IpDnsAddress", "IpDns2Address", "IpWinsAddress",
"IpWins2Address", "IpAssign", "IpNameAssign",
"IpFrameSize", "IpDnsFlags", "IpDnsSuffix",
"@crlfNETCOMPONENTS", "ms_server", "ms_msclient",
"@crlfMEDIA", "Port", "Device",
"ConnectBPS", "@crlfDEVICE", "PhoneNumber",
"AreaCode", "CountryCode", "CountryID",
"UseDialingRules", "Comment", "LastSelectedPhone",
"PromoteAlternates", "TryNextAlternateOnFail","HwFlowControl",
"Protocol", "Compression", "Speaker",
"MdmProtocol"

$values="1", "1", "1",
"4534710", "3071687F4E18E54C8CF498F62B4F0DE3", "1",
"0", "0", "1",
"8", "1", "1",
"0", "0", "0",
"1", "75", "120",
"10", "120", "15",
"3", "60", "0",
"0", "0", " ",
" ", " ", "0",
"0", "1", "1",
" ", " ", " ",
" ", "1", "0",
"1", "1", "1",
"-1", "608", "2",
"1", "1", "0.0.0.0",
"0.0.0.0", "0.0.0.0", "0.0.0.0",
"0.0.0.0", "1", "1",
"1006", "1", " ",
" ", "0", "1",
"serial", "COM3", "Xircom Cardbus Ethernet 100 + Modem 56 (Modem Interface)",
"115200", "modem", "1 800 123-4567",
"877", "1", "1",
"0", "56K connection", "0",
"0", "1", "1",
"1", "1", "1",
"0"

$pbk = "%USERPROFILE%\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk"
if $machine $pbk = "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk" endif

if ubound($arrayElements) <> ubound($arrayValues)
? "Optional parameters not equal"
return
endif

if not instr(readprofilestring($pbk,"",""), $connection)
for $index=0 to ubound($params)
$=writeprofilestring("$pbk","$connection",$params[$index] ,$values[$index] )
next
endif

endfunction

_________________________
How to ask questions the smart way <-----------> Before you ask