Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This script checks local user VPN strategy and overrides it – this is important as Windows
- #dynamically changes and updates this, often to undesired settings.
- #Get rasphone.pbk path for local user
- $RASPhone = ($env:USERPROFILE) + '\Appdata\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk'
- #Get current VPN Strategy (5=SSTP only, 6=SSTP first, then others, 7= IKEv2 only, 8=IKEv2
- #first, then others, 14=IKEv2 then SSTP
- $OldVPNStrategy = (Get-Content $RASPhone) -like "VpnStrategy=?"
- #Set desired VPN Strategy – should be 14 for IKEv2 preferred and SSTP as fallback
- $NewVPNStrategy = "VpnStrategy=6"
- #Check if current VPN Strategy matches desired, end if true, continue if false
- If ($OldVPNStrategy -ne $NewVPNStrategy)
- {
- (Get-Content $rasphone).Replace($OldVPNStrategy,$NewVPNStrategy) | Set-Content $RASPhone
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement