• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Install OpenVPN using Group Policy

Scheduled Pinned Locked Moved OpenVPN
2 Posts 2 Posters 614 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    Snailkhan
    last edited by Oct 15, 2024, 5:38 PM

    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

    D 1 Reply Last reply Oct 16, 2024, 8:49 PM Reply Quote 0
    • D
      dlogan @Snailkhan
      last edited by Oct 16, 2024, 8:49 PM

      @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
      
      
      
      1 Reply Last reply Reply Quote 0
      1 out of 2
      • First post
        1/2
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
        This community forum collects and processes your personal information.
        consent.not_received