Install OpenVPN using Group Policy
-
Hi
I have openvpn setup in pfsens, i want to deploy it to some 50 plus users machines. they do not have admin rights and are in domain.Is it possible to install it using group policy ?
Really appreciate if someone can share some doc related to it.Regards
-
@Snailkhan Sure. Just grab the .msi installer and deploy it with GPO, or like I do with a Powershell script that calls msiexec /qn
$StartTime = Get-Date ############################################################################################# ## Variables ############################################################################################# $PackageName = "OpenVPN Connect" [version]$CurrentVersion = "3.5.0" $InstallerFileName = "openvpn-connect-3.5.0.3818_signed.msi" $MSIPackage = "$PSScriptRoot\$InstallerFileName" $LogDir = "C:\Admin\Logs" $MyDate = Get-Date -Format "MM-dd-yyyy_HHmm" $LogName = $PackageName + "_Install_" + $MyDate + ".txt" $UpdateLogName = $PackageName + "_Update_" + $MyDate + ".txt" $Log = "$LogDir\$LogName" ############################################################################################# ## Function to get software version - just pass it the package name found in registry ############################################################################################# function Get-InstalledSoftwareVersion { Param ( [Parameter(Position=0, Mandatory=$true)] [string]$PackageName ) $InstalledSoftware = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' | Where-Object {$_.DisplayName -ne $null} | Select-Object DisplayName,Displayversion | Sort-Object -Property DisplayName [version]$PackageInstalledVersion = ($InstalledSoftware | Where-Object {$_.DisplayName -eq "$PackageName"}).DisplayVersion return $PackageInstalledVersion } ############################################################################################# ## Function to install MSI base package ############################################################################################# function Install-MSIPackage { $MSIArguments = @( "/i `"$MSIPackage`"" "/qn" "/L*V `"$Log`"" ) Write-Host "Starting msiexec installation." Write-Host "Start-Process msiexec -ArgumentList $MSIArguments -Wait" Start-Process msiexec -ArgumentList $MSIArguments -Wait } ############################################################################################# ## Main ############################################################################################# #Check if agent is installed and current Write-Host "Checking if $PackageName is installed." [version]$PackageInstalledVersion = Get-InstalledSoftwareVersion -PackageName $PackageName if ($PackageInstalledVersion -eq $null){ Write-Host "$PackageName not found. Running installer." -ForeGroundColor Yellow Install-MSIPackage } elseif ($PackageInstalledVersion -lt $CurrentVersion) { Write-Host "$PackageName $PackageInstalledVersion found but is out of date. Current version is $CurrentVersion" Write-Host "Running installer." Install-MSIPackage } else { Write-Host "Package is up to date, checked against version:$CurrentVersion" -ForegroundColor Green } $EndTime = Get-Date $RunTime = $EndTime - $StartTime Write-Host "Script run time:" $RunTime | Select Hours,Minutes,Seconds,Milliseconds