Hi! Im new to powershell and it didn’t take for me too long to face first problem. I want to create a vpn connection via powershell but it need to have checked “Disable class based route addition” in IPV4 cart
Unfortunately i didn’t see anything about it in documentation. I’ve read that you can change content in rasphone.pbk but i have other connetions made earlier and I don’t know how to edit this specific one. Any ideas? Thanks in advice.
$ConnectionName="test2"
$ServerAdress="1.1.1.1"
$Password="test"
$RasphoneDefaultPath ="$env:AppData\Microsoft\Network\Connections\Pbk\rasphone.pbk"
$RasphoneCopyPath="$env:AppData\Microsoft\Network\Connections\"
Copy-Item -Path $RasphoneDefaultPath -Destination $RasphoneCopyPath
Add-VpnConnection -Name $ConnectionName -ServerAddress "1.1.1.1" -TunnelType L2tp -L2tpPsk $Password -RememberCredential -AuthenticationMethod MSChapv2,Chap -EncryptionLevel "Required" -SplitTunneling -Force
$RasphoneToArray=Get-Content($RasphoneDefaultPath)
// Change thingy on the screen in rasphone.pbk then save it
$RasphoneToArray | Out-File $env:AppData\Microsoft\Network\Connections\Pbk\rasphone.pbk
howdy adseb007,
use a reg monitor or diff util to see what changes. i am willing to bet one virtual beer that it boils down to a reg entry … [grin]
take care,
lee
((Get-Content -path “$env:USERPROFILE\AppData\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk” -Raw) -replace ‘DisableClassBasedDefaultRoute=0’,‘DisableClassBasedDefaultRoute=1’) | Set-Content -Path “$env:USERPROFILE\AppData\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk”
Hey!
Thanks for answear! I’ve tried to scan differences as you told me but it didn’t show any related entry changes
Any other ideas?
Hey, thanks for reply, but that will cause issues, when you have already some VPN connections which you dont want to eddit 
Sorry, your submission has been automatically removed.
Accounts must be at least 1 day old, which prevents the sub from filling up with bot spam.
Try posting again tomorrow or message the mods to approve your post.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
howdy adseb007,
you are welcome! it looks like i owe you a virtual beer … [grin]
that is all i can think of. my search-fu is not up to finding anything on the subject, either. have you tried a registry comparison util like …
RegistryChangesView - Compare snapshots of Windows Registry
— RegistryChangesView - Compare snapshots of Windows Registry
plus, the sysinternals procmon
util has a registry monitor ability. there once was a regmon
, but they merged it into procmon
.
take care,
lee
Hey! I have tried WhatChanged 1.07. But I’ve already found (not so great tho) answear for this. Converted Rasphone.pbk to array, reversed it and changed 68 element from DisableClassBasedDefaultRoute=0 to 1, reversed it and saved. From my observations 69 line from bottom is always DisableClassBasedDefaultRoute of newest Dial. Thanks for your help and hope this can help somebody 
howdy adseb007,
kool! so that info is in the ras phone book, not in the registry. odd … but good to know. thanks for the feedback! [grin]
plus, i am glad to know that you got it working as needed.
take care,
lee