(136) Microsoft Intune - Remediations for L2TP VPN
- Mr B SOE way
- Jul 16, 2024
- 1 min read
In a previous post I covered about creating a Win32 app for deploying L2TP VPN with user context in place, I found a better solution where you can use "Remediations" which can be found to this link.
For Detection, we will use:
try{
if (Get-VpnConnection -AllUserConnection -Name "VPN" -ErrorAction Stop)
{
write-host "Success"
exit 0
}
}
catch{
$errMsg = $_.Exception.Message
write-host $errMsg
exit 1
}
For Remediation, we will use:
try{
Add-VpnConnection -Name "VPN" -ServerAddress "VPN.domain.local" -TunnelType L2TP -L2tpPsk "SecretPassword" -Force -AuthenticationMethod Optional -RememberCredential -AllUserConnection -ErrorAction Stop
exit 0
}
catch{
$errMsg = $_.Exception.Message
Write-host $errMsg
exit 1
}
Upload the scripts like this: Then for the following: Run this script using the logged on credentials: No Enforce script signature check: No Run script in 64-bit PowerShell: Yes
Then deploy to the required groups.
Kommentare