Skip to content

Instantly share code, notes, and snippets.

@bryceprutsos
Created November 25, 2020 09:35
Show Gist options
  • Save bryceprutsos/9c3f82b4f5866fa00c4e491996c5c26f to your computer and use it in GitHub Desktop.
Save bryceprutsos/9c3f82b4f5866fa00c4e491996c5c26f to your computer and use it in GitHub Desktop.
VPN CLI connect - Check Point #powershell
# Check Point client automation
# https://www.checkpoint.com/products/remote-access-vpn
param ($Endpoint = "91.143.218.198")
if (!(Get-Module CredentialManager)) {
Write-Waarning "Powershell module CredentialManager not found, installing"
Install-Module CredentialManager
}
$scriptName = $MyInvocation.MyCommand.Name -replace '.ps1'
$target = "vpn/$scriptName"
$cred = Get-StoredCredential -Target $target
if (!$cred) {
Write-Warning "VPN credentials for '$scriptName' not found, requiring user input"
$username = Read-Host -Prompt "Username"
$password = Read-Host -AsSecureString -Prompt "Password"
$params = @{
Target = $target
Persist = 'LocalMachine'
Username = $username
Password = [PSCredential]::new(0, $password).GetNetworkCredential().Password
}
New-StoredCredential @params | Out-Null
$cred = Get-StoredCredential -Target $target
}
$username = $cred.UserName
$password = $cred.GetNetworkCredential().Password
sal trac "${Env:ProgramFiles(x86)}\CheckPoint\Endpoint Connect\trac.exe"
"Y" | trac create -s $endpoint -a username-password
trac connect -s $Endpoint -u $username -p $password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment