IPSEC IKEv2 with direct certificate

Hello Forum,

I have the following command and I want my IPSEC connection to take the following certificate:

Cert:\LocalMachine\Root\cert-test ← Certificate name

How can I include this in this command:

Add-VPNConnection -AllUserConnection -Name “VPN2” -ServerAddress 123.123.123.123 -TunnelType “Ikev2” -EncryptionLevel “Maximum” -AuthenticationMethod “EAP” -RememberCredential -SplitTunneling

Thanks for the help! :blush:

Hello and welcome to forums!
I didn’t test but the following example might give you some hints:

# CN entry of the certificate
$Doman = "COMPUTER_NAME"

$Cert = Get-ChildItem -Path Cert:\LocalMachine\Root | Where-Object {
		$_.Subject -eq "CN=$Domain"
	}

if ($Cert -and (Test-Certificate -Cert $Cert -Policy SSL))
{
    Add-VPNConnection -AllUserConnection -Name "VPN2" -ServerAddress 123.123.123.123 `
       -TunnelType "Ikev2" -EncryptionLevel "Maximum" -AuthenticationMethod "EAP" `
       - RememberCredential -SplitTunneling -MachineCertificateIssuerFilter $Cert
}

see also for parameter sets: