In this guide, we’ll use Robopack to simplify the packaging and deployment of FortiClient VPN in Microsoft Intune. If you’re unfamiliar with the solution, you can learn more about Robopack and how it helps IT administrators automate application packaging, deployment and updates.

FortiClient VPN is a poor fit for a catalogue install that stops at the MSI. The connection settings have to travel in a backup you export from a client that already connects. Attach that file to the Robopack Instant App, import it with FCConfig.exe after the MSI, and set FA_UPDATE to 0 in the same phase so automatic updates stay off.

This procedure uses FortiClient VPN 7.4.3.4726 from Instant Apps, with PSAppDeployToolkit 4.1.8, MSI, x64. When the status reads UPLOADED TO INTUNE, the package ready to assign is FortiClient VPN 7.4.3. The profile is already loaded, and automatic updates are off because FA_UPDATE is 0. xx

Deploy FortiClient VPN with Intune – Prerequisites

Five items decide the package. Set the backup password before you export. If you set one, Post-Install has to pass it. If you leave the backup unprotected, Post-Install has to omit it.

ItemRole in the package
A configured FortiClient VPNThe client that already has the connection settings you want on every PC.
The backup fileThe export from that client. The sample name is VPN_client.conf.
Robopack Instant AppsThe catalog tile FortiClient VPN, publisher Fortinet Technologies Inc. Search for FortiClient.
PSAppDeployToolkit 4.1.8The script host inside that Instant App. The package is an MSI, x64.
The Intune tenantWhere the package goes after the file and the script are in it.

Export the VPN configuration

Deploy FortiClient VPN with Intune

On the PC where FortiClient VPN already has the connection you want to deploy:

  1. Open FortiClient VPN.
  2. Open Settings. The control is the gear at the top right.
  3. Open System.
  4. Click Backup and save the file. The sample name is VPN_client.conf. On a French-language client that control reads Sauvegarde, under Système.

FortiClient then asks whether to protect the file with a password. If you set one, keep it. You will type it into Post-Install in place of YourPassword. If you leave the backup unprotected, Post-Install uses the block that has no -p switch.

Select FortiClient VPN in Instant Apps

Deploy FortiClient VPN with Intune

In Robopack Instant Apps, type FortiClient in the search box. Select the FortiClient VPN tile. The publisher on that tile is Fortinet Technologies Inc.

Import the FortiClient VPN and keep it out of Intune

Deploy FortiClient VPN with Intune

The window title is Analyze & build Instant App. On step 2, Review:

  1. Clear Quick Import to Intune. The package still needs the configuration file and the script. A checked box would send it to Intune on this step.
  2. Click Import app, at the bottom right.

Import app creates the package in Robopack. The upload to Intune is a later action, after the custom settings are saved.

Open Add Custom Setting

Deploy FortiClient VPN with Intune

Open the FortiClient VPN package. In the ACTIONS menu on the right, click Add Custom Setting. It sits at the bottom of that menu. That opens the file list and the PSAppDeployToolkit 4 phases.

Add VPN_client.conf as a script accessory file

In App settings, on Files:

Deploy FortiClient VPN with Intune
  1. Click + Add file.
  2. Select the backup you exported. Keep the name VPN_client.conf if that is the name you saved.
  3. In Edit file, select the right-hand tab: Include in script, but do not copy.
  4. Click Save.
Deploy FortiClient VPN with Intune

The file then appears under Script accessory files.

Include in script, but do not copy places VPN_client.conf in the package support folder. The script reaches that folder through $adtSession.DirSupportFiles. The file is not written in clear text on the user’s disk. FCConfig.exe imports it during install.

The filter in Post-Install has to be the same file name. If you saved the backup under another name, use that name in the filter and in the error text, in both places.

Simplify Your Intune Application Management

Stop spending hours manually packaging and updating applications. Robopack helps automate application packaging, deployment and updates in Microsoft Intune, reducing administrative overhead and keeping your applications up to date.

Discover Robopack →

Official Robopack reseller • Free trial available • Expert support

Paste the PSAppDeployToolkit 4 script

Paste each block into the phase with the same name. Leave $installerPath, $adtSession.DirSupportFiles, and $envProgramFiles as written.

Install runs Pre-Install, then Install, then Post-Install. Removal runs Pre-Uninstall, then Uninstall, then Post-Uninstall.

Pre-Install

Stop the client processes, then stop each service that is present.

//Deploy FortiClient VPN with Intune - Preinstall
Get-Process -Name 'FortiClient','FortiSSLVPNdaemon','FortiTray' -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
foreach ($svc in @('FortiClientVPNService','FortiClient_Service','FortiClient_Scheduler','FortiClientSslvpnDaemon')) {
    if (Get-Service -Name $svc -ErrorAction SilentlyContinue) {
        Stop-Service -Name $svc -Force -ErrorAction SilentlyContinue
    }
}

Install

//Deploy FortiClient VPN with Intune - Install
Start-ADTMsiProcess -FilePath "$installerPath" -ArgumentList 'REBOOT=ReallySuppress ALLUSERS=1'

Post-Install

This phase turns automatic updates off, then imports the backup.

The registry path is HKLM\SOFTWARE\Fortinet\FortiClient\FA_UPDATE. The value name is enabled, the type is DWord, and the data is 0.

The script searches $adtSession.DirSupportFiles for the backup. If that file is missing, the script stops on the throw line. FCConfig.exe is $envProgramFiles\Fortinet\FortiClient\FCConfig.exe. The arguments are -m vpn -o import -f and the full path of the backup.

Use the first block when the backup is password-protected. Replace YourPassword with the export password and keep -p. Save the phase only after that placeholder is gone.

//Deploy FortiClient VPN with Intune - Post-Install
Set-ADTRegistryKey -LiteralPath 'HKLM\SOFTWARE\Fortinet\FortiClient\FA_UPDATE' -Name 'enabled' -Type DWord -Value 0<br>$conf = Get-ChildItem -LiteralPath $adtSession.DirSupportFiles -Filter 'VPN_client.conf' -Recurse -File -ErrorAction SilentlyContinue | Select-Object -First 1<br>if (-not $conf) { throw 'File VPN_client.conf missing.' }<br>Start-ADTProcess -FilePath "$envProgramFiles\Fortinet\FortiClient\FCConfig.exe" -ArgumentList "-m vpn -o import -f `"$($conf.FullName)`" -p YourPassword"

Use the second block when the backup has no password. The argument list ends after the file path.

Set-ADTRegistryKey -LiteralPath 'HKLM\SOFTWARE\Fortinet\FortiClient\FA_UPDATE' -Name 'enabled' -Type DWord -Value 0<br>$conf = Get-ChildItem -LiteralPath $adtSession.DirSupportFiles -Filter 'VPN_client.conf' -Recurse -File -ErrorAction SilentlyContinue | Select-Object -First 1<br>if (-not $conf) { throw 'File VPN_client.conf missing.' }<br>Start-ADTProcess -FilePath "$envProgramFiles\Fortinet\FortiClient\FCConfig.exe" -ArgumentList "-m vpn -o import -f `"$($conf.FullName)`""

One PC gets one of these two blocks.

Pre-Uninstall

Stop the services and set them to Disabled. This list adds FA_Scheduler, which Pre-Install does not include. Then stop the processes. This list adds FortiSettings, FortiVPN, and scheduler.

foreach ($svc in @('FA_Scheduler','FortiClientVPNService','FortiClient_Service','FortiClient_Scheduler','FortiClientSslvpnDaemon')) {
    if (Get-Service -Name $svc -ErrorAction SilentlyContinue) {
        Stop-Service -Name $svc -Force -ErrorAction SilentlyContinue
        Set-Service -Name $svc -StartupType Disabled -ErrorAction SilentlyContinue
    }
}
Get-Process -Name 'FortiClient','FortiSSLVPNdaemon','FortiTray','FortiSettings','FortiVPN','scheduler' -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue

Uninstall

//Deploy FortiClient VPN with Intune - Uninstall
Start-ADTMsiProcess -Action Uninstall -FilePath "$installerPath" -ArgumentList '/qn REBOOT=ReallySuppress'

Install passes REBOOT=ReallySuppress ALLUSERS=1. Uninstall passes /qn REBOOT=ReallySuppress and sets the action to Uninstall. Keep each list on its own phase.

Post-Uninstall

Remove the enabled value that Post-Install created.

Remove-ADTRegistryKey -LiteralPath 'HKLM\SOFTWARE\Fortinet\FortiClient\FA_UPDATE' -Name 'enabled'

Import to Intune or start a Robopatch flow

Deploy FortiClient VPN with Intune

Save the custom settings and wait until the package has been rebuilt. Open the FortiClient VPN package again. In ACTIONS, at the top right, choose one action.

  • Setup / See Robopatch flow. This is the path for deployment waves and for later updates.
  • Import to Intune. This sends the customized .intunewin to the tenant now, with no flow.

When the status reads UPLOADED TO INTUNE, FortiClient VPN 7.4.3 is ready to assign to your groups. The VPN configuration is already in the package, and automatic updates are off (FA_UPDATE is 0).

Field recommendations

These are the choices that change the result when you skip them.

  • Clear Quick Import to Intune on Review, then click Import app.
  • Add the backup with Include in script, but do not copy, so FCConfig.exe reads it from $adtSession.DirSupportFiles and the file is not written in clear text on the user’s disk.
  • Keep the Post-Install filter identical to the file you added. The sample name is VPN_client.conf.
  • Pass -p and the export password only for a protected backup. Use the block with no -p for an unprotected backup. Remove YourPassword before you save the phase.
  • Keep the install argument list and the uninstall argument list as written. They are different on purpose.
  • Keep the Pre-Install process and service lists separate from the Pre-Uninstall lists. Pre-Uninstall is the phase that disables services, adds FA_Scheduler, and stops FortiSettings, FortiVPN, and scheduler.
  • Set FA_UPDATE enabled to 0 after the MSI. Remove that value in Post-Uninstall.
  • Choose Setup / See Robopatch flow for waves and later updates. Choose Import to Intune for a direct upload of this package.

Microsoft documentation

Robopack uploads a Win32 package, the .intunewin file. These pages describe that app model. The profile import stays the FCConfig sequence above.

Conclusion

The deploy holds when three things match. The backup comes from a FortiClient VPN that already has the connection. That file is a script accessory file, under the name the Post-Install filter uses. FCConfig.exe imports it after the MSI, with -p only when the backup has a password. FA_UPDATE set to 0 is what keeps automatic updates off. Assign the app in Intune after the status reads UPLOADED TO INTUNE.

Comments (0)