How to rollout AppGate headless client via scripts on Windows OS

Prev Next

If you have SCCM or another similar tool, you can deploy AppGate headless client using a PowerShell script. This approach optimizes the client rollout process through automation, guaranteeing a smoother and standardized deployment for your AppGate users.

Copy the below script to a file and customize the following variables accordingly:

$workingDir = "C:\Temp\"

You can change the location to any suitable place or keep it as it is, this is totally optional.

$installerURL = "Put_Client_Location_URL"

Specify your client location, whether it be a local or public address.
Ex: - “C:\Users\win10-esxi\Desktop\ AppGate-SDP-client.exe”
Ex: - https://bin.appgate-sdp.com/latest/windows/AppGate-SDP-client.exe

$HeadlessSPA = "Your_Client_Profile_URL"

Specify your full client profile.
Ex: - “appgate://mycontroller.company.com/eyjk2YTJiMvDKWFlMNhdGUifQ==”

# MIT License
# Copyright (c) 2025 AppGate Cybersecurity, Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#Update to your login details.
$Uname = "Headless username"
$Upasswd = "Headless password"

#Headless SPA
$HeadlessSPA = "Your_Client_Profile_URL"

#Client Binary location
$installerURL = "Put_Client_Location_URL"

#The below can be changed if you like.
$workingDir = "C:\temp\"


#Don't change these they are used in the script.
$date = Get-Date -Format yyyy_MM_dd
$tmpdir = Test-Path $workingDir
if (-not $tmpdir) { New-Item -ItemType Directory -path $workingDir > $null }
$filename = Split-Path $installerURL -Leaf
$path = $workingDir + $filename

$Global:SDPLogFile = $workingDir + "SDPInstallLog-" + $date + ".txt"

#Downloads the AppGate Client before installing.
Function DownloadAppgate
{
	try
	{
		Write-Host "Downloading Client Installer."
		(New-Object Net.WebClient).DownloadFile($installerURL, $path)
	}
	catch
	{
		$_.Exception.Message
		Write-Host "Something went wrong Downloading Client Installer."
	}
}

Function installAppgateHeadless
{
	DownloadAppgate
	try
	{
		Write-Host "Installing Appgate Client."
		Start-Process -Wait -FilePath $Path -ArgumentList "/E /S /A"
		Write-Host "AppGate Headless Install done."
		$SDPPATH = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_.DisplayName -like "Appgate*" } | select DisplayName, UninstallString, InstallLocation
		$SDPconfig = $SDPPATH.InstallLocation + "\service\AppGate SDP Service Configurator.exe"
		$SDPCFGOut = $workingDir + "sdpcfgout.txt"
		$SDPStatus = $workingDir + "sdpstatus.txt"
		
		Write-Host "Running Config."
		start-process -Wait -filepath $SDPconfig -ArgumentList "set -u $Uname -p $Upasswd" | Out-Null
		start-process -Wait -filepath $SDPconfig -ArgumentList "set -o `"$HeadlessSPA`"" | Out-Null
		sleep 30
		start-process -Wait -filepath $SDPconfig -ArgumentList "get --config" -RedirectStandardOutput $SDPCFGOut
		start-process -wait -filepath $SDPconfig -ArgumentList "get --status" -RedirectStandardOutput $SDPStatus
		Write-Host "Getting DNS Reg setting"
		Get-NetAdapter -InterfaceDescription "Appgate Tunnel" | Get-DnsClient | Select RegisterThisConnectionsAddress, UseSuffixWhenRegistering
		Write-Host "Turning off DNS Registration"
		Get-NetAdapter -InterfaceDescription "Appgate Tunnel" | Set-DnsClient -RegisterThisConnectionsAddress:$false -UseSuffixWhenRegistering:$false
		Write-Host "Getting DNS Reg setting"
		Get-NetAdapter -InterfaceDescription "Appgate Tunnel" | Get-DnsClient | Select RegisterThisConnectionsAddress, UseSuffixWhenRegistering
		Write-Host "Config done."
		Get-Content  $SDPCFGOut, $SDPStatus
		Write-output "AppGate Headless Install done. `n" | Out-File -Append $SDPLogFile
		#Cleanup
		
	}
	catch
	{
		$_.Exception.Message
		Write-Host "Something went wrong Installing AppGate Headless client"
	}
}
DownloadAppgate
installAppgateHeadless