Meraki Client VPN Powershell deployment

New here

Meraki Client VPN Powershell deployment


I'm working on the following script to try and deploy Meraki VPN to client computers but not having much luck with the pre-configured user account which i have set up via Meraki Portal as a guest account:


Set-ExecutionPolicy Unrestricted
$User = ""
$PWord = ConvertTo-SecureString -String "Bob123" -AsPlainText -Force
$compIP = "server address" 
$VPNPresharedKey = "key" 
$EncryptionLevel = "Required"
$RememberCredential = $true
$vpnnamn = 'MerakiVPN'
$SplitTunnel = $true

$RegistryPath = "HKLM:\System\CurrentControlSet\Services\PolicyAgent"
$RegName = 'AssumeUDPEncapsulationContextOnSendRule'
$Regvalue = 2
New-ItemProperty -Path $RegistryPath -Name $RegName -Value $Regvalue -PropertyType DWORD -Force

$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord
Add-VpnConnection -Name "$vpnnamn" -ServerAddress "$compIP" -TunnelType L2tp -AllUserConnection -L2tpPsk "$VPNPresharedKey" -AuthenticationMethod Pap ,MSChapv2 -EncryptionLevel Required -Force
Set-VpnConnection -AllUserConnection -Name $vpnnamn -SplitTunneling $true -RememberCredential $RememberCredential -IdleDisconnectSeconds $IdleDisconnect


I have gathered a lot of the commands through various forums as i'm still a novice with powershell but the bit that is failing for me is the username and password not showing up under the connection properties after the VPN connection has been added. Both username and password boxes are blank.


Any ideas?


Thanks in advance

5 Replies 5
Getting noticed

Hi, we are using this Powershell script. Try to arrange as your needs.

The script could be automated via Windows Server GPO as startup computer script.


Kind of a big deal
Kind of a big deal

Try my client VPN wizard.  It lets you create reasonably advanced configurations. 

thanks Phillip,


-> where can i insert the -AllUserConnection Parameter in your script?

You can't anymore.  That option no longer exists with the Windows VPNv2 CSP engine.

Has anybody had issues running this on windows 11, run as none admin or admin, getting the following errror
"Unable to create Vpn profile: A general error occurred that is not covered by a more specific error code."

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.