This is a little dense/long but hopefully some of this will be helpful.
Example with a FortiOS 6.2 device (Win 10 user tunnel):
https://www.delapcpa.com/cybersecurity/ikev2-vpn-guide/
FortiOS CLI
https://docs.fortinet.com/document/fortigate/6.0.0/cli-reference/791036/vpn-ipsec-phase1-interface-phase1
https://docs.fortinet.com/document/fortigate/6.0.0/cli-reference/487941/vpn-ipsec-phase2-interface-phase2
Windows 10 stuff:
https://directaccess.richardhicks.com/2017/12/11/always-on-vpn-windows-10-device-tunnel-step-by-step-configuration-using-powershell/
https://directaccess.richardhicks.com/2018/07/23/always-on-vpn-routing-configuration/
https://docs.microsoft.com/en-us/windows-server/remote/remote-access/vpn/vpn-device-tunnel-config
https://www.configjon.com/always-on-vpn-device-tunnel/
Things to consider with a device tunnel:
https://directaccess.richardhicks.com/2020/04/06/always-on-vpn-device-tunnel-only-deployment-considerations/
Enable device tunnel status in Windows 10:
https://directaccess.richardhicks.com/2020/08/27/always-on-vpn-device-tunnel-status-indicator/
Name Resolution Policy Table:
https://directaccess.richardhicks.com/2018/04/23/always-on-vpn-and-the-name-resolution-policy-table-nrpt/
https://serverfault.com/questions/925901/windows-10-always-on-vpn-split-dns-nrpt-and-how-to-configure-which-dns-server
Troubleshooting:
https://www.imab.dk/my-always-on-vpn-configuration-with-microsoft-intune-and-configuration-manager-explained/
https://msendpointmgr.com/2020/04/29/keeping-always-on-vpn-always-on/
https://www.configjon.com/always-on-vpn-troubleshooting/
Some Client info:
Get info on the status of a device tunnel VPN connection
Get-VpnConnection -AllUserConnection
You can see if a VPN tunnel exists by looking at the list of networking adapters in the GUI. It will show up as a networking adapter. Do not change the config on the adapter via the GUI.
The service ‘IKE and AuthIP IPsec Keying Modules’ (IKEEXT) has to have a startup type as Automatic in order for the VPN to work. This service is not on a lot of the time. Also, after a Feature Update or monthly patch it may go back to manual or disabled. So it should have a GPO setting to change the service to automatic.
Set-Service -Name "IKEEXT" -StartupType Automatic
Start-Service -Name "IKEEXT"
Get-Service -Name "IKEEXT"
Need this PowerShell module in order to install/update the VPN as the System user for device tunnels (instead of having to use psexec).
Install-Module -Name Invoke-CommandAs
Install the VPN connection or overwrite an existing config (as the system user)
Invoke-CommandAs -ScriptBlock {c:\AOVPN\New-AovpnDeviceTunnel.ps1 -xmlFilePath c:\AOVPN\AOVPN.xml} -AsSystem
Manually Remove the Device Tunnel VPN Connection:
rasdial.exe "Always On VPN Device Tunnel" /disconnect
Remove-VPNConnection -Name "Always On VPN Device Tunnel" -AllUserConnection -Force -PassThru
Make a device tunnel VPN connection visible via the GUI by adding a registry key:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Flyout\VPN]
"ShowDeviceTunnelInUI"=dword:00000001
Repair an Always-On VPN, including device tunnel and show some info along the way:
Write-Host "Fixing the IKEEXT Service"
Set-Service -Name "IKEEXT" -StartupType Automatic
Start-Service -Name "IKEEXT"
Get-Service -Name "IKEEXT"
Write-Host "Importing the registry key so the VPN shows up in the task bar connections list."
reg import "C:\AOVPN\VPNStatusForUser.reg"
Write-Host "Checking for the AutoTriggerDisabledProfileList reg key and deleting it if necessary. Disregard error messages."
$regkeypath="HKLM:\SYSTEM\CurrentControlSet\Services\RasMan\Config"
$regkeyitem="AutoTriggerDisabledProfilesList"
$regkeyvalue="Always On VPN Device Tunnel"
$value1 = (Get-ItemProperty $regkeypath).$regkeyitem -eq $regkeyvalue
If ($value1 -eq $False) {Remove-ItemProperty -path $regkeypath -name $regkeyitem}
Else {Write-Host "The value does not exist"}
Write-Host "Use the rest of the script with caution - resets all IPv4, IPv6, and Winsock settings."
Write-Host "Close the script if you don't want these things reset."
pause
Write-Host "Resetting all NIC IPv4, IPv6, and Winsock settings"
netsh int ip reset
netsh int ipv6 reset
netsh winsock reset
pause
edit: added some more content