사용자 엔드포인트를 배포하는 중, FortiClient VPN의 VPN 접속 프로파일을 자동으로 등록할 필요가 있어 스크립트를 작성해 보았다.
Fortinet에서는 FCConfig
라는 별도의 유틸리티를 제공하긴 하지만, 이 유틸리티의 vpnimport
기능은 제대로 동작하지 않는다. 전체 설정을 import 해야 하는 경우가 아니라면, FortiClient의 레지스트리 키 값을 직접 수정하는 편이 낫다.
## You should run this script as an Administrator ##
# Forticlient Profile Settings
$pathinstfolder="C:\Program Files\Fortinet\FortiClient"
$fcprofilename = "YourProfileName"
$fcprofiledesc = 'YourProfileDesc'
$fcprofileserver = 'YourFQDN:Port'
$fcpath = "" + $pathinstfolder + "\forticlient.exe"
$fcr = 'REBOOT=ReallySuppress'
Start-Process -FilePath $fcpath -ArgumentList '/qn', $fcr
Start-Sleep 5
# Install VPN Profiles
$fcpathreg = "HKLM:\SOFTWARE\Fortinet\FortiClient\Sslvpn\Tunnels\" + $fcprofilename + ""
if ((Test-Path -LiteralPath $fcpathreg) -ne $true) {
New-Item -Path $fcpathreg
New-ItemProperty -LiteralPath $fcpathreg -Name 'Description' -Value $fcprofiledesc -PropertyType String -Force -ea SilentlyContinue;
New-ItemProperty -LiteralPath $fcpathreg -Name 'Server' -Value $fcprofileserver -PropertyType String -Force -ea SilentlyContinue;
New-ItemProperty -LiteralPath $fcpathreg -Name 'promptusername' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue;
New-ItemProperty -LiteralPath $fcpathreg -Name 'promptcertificate' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue;
New-ItemProperty -LiteralPath $fcpathreg -Name 'ServerCert' -Value '1' -PropertyType String -Force -ea SilentlyContinue;
}
else {
Write-Outputn "Profile already exists, skipping..."
}
이 스크립트는 다음과 같은 환경에서 테스트 되었다.
이 스크립트는 다음 링크의 스크립트를 수정한 것이다.
Reddit - Deploying SSL VPN + SSL VPN settings via GPO / Automate Script