Import configuration file client_VPN.vpn with powershell

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
SHsora
Posts: 2
Joined: Tue Jun 20, 2023 10:24 am

Import configuration file client_VPN.vpn with powershell

Post by SHsora » Tue Jun 20, 2023 10:28 am

Hi,

I want to import a configuration file with powershell

i try many thing and vpncmd.Exe but got nothing working ,

got no specific error message , he just tell that this way is not good with vpncmd and this way he cant connect but i dont want to connect anything just import config file

please help ?

SHsora
Posts: 2
Joined: Tue Jun 20, 2023 10:24 am

Re: Import configuration file client_VPN.vpn with powershell

Post by SHsora » Tue Jun 20, 2023 11:46 am

this work fine s not silently but do the thing by himself

is anyone have better please tell me


function Install-SoftEtherVPN {
try {
# Specify paths
$exeFileName = "softether.exe"
$vpnSettingsFileName = "config_VPN.vpn"
$SoftwareFolder = "path"

# Formulate file paths
$exeFilePath = Join-Path $SoftwareFolder $exeFileName
$vpnSettingsFilePath = Join-Path $SoftwareFolder $vpnSettingsFileName

# Check if specified files exist
if (!(Test-Path $exeFilePath)) {
throw "Specified SoftEther VPN executable file not found"
}
if (!(Test-Path $vpnSettingsFilePath)) {
throw "Specified VPN settings file not found"
}

# Start the installer
Start-Process -FilePath $exeFilePath -PassThru

# Wait for the installer window to appear
Start-Sleep -Seconds 5

# Automate the installation steps
[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1

[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1

[System.Windows.Forms.SendKeys]::SendWait('{TAB}')
Start-Sleep -Seconds 1

[System.Windows.Forms.SendKeys]::SendWait('{TAB}')
Start-Sleep -Seconds 1

[System.Windows.Forms.SendKeys]::SendWait(' ')
Start-Sleep -Seconds 1

[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1

[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1

[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 1

[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 30

[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')
Start-Sleep -Seconds 2

# Load VPN settings
Start-Process -FilePath $vpnSettingsFilePath

Start-Sleep -Seconds 3

[System.Windows.Forms.SendKeys]::SendWait('{ENTER}')


} catch {
Write-Host "Failed to install SoftEther VPN: $_"
}
}

solo
Posts: 1285
Joined: Sun Feb 14, 2021 10:31 am

Re: Import configuration file client_VPN.vpn with powershell

Post by solo » Tue Jun 20, 2023 12:43 pm

SHsora wrote:
Tue Jun 20, 2023 11:46 am
is anyone have better please tell me
Better than Powershell...
"C:\Program Files\SoftEther VPN Client\vpnsetup.exe" /easy:true
Easy Installer Creator is a tool for enterprise administrators. You can create a VPN Client installer with embedding a specific VPN connection setting by using Easy Installer Creator. Personal users can also exploit this tool.

A created Easy Installer can be distributed to employees in the enterprise by using file servers or e-mails. If a user runs the Easy Installer, VPN Client will be installed and the VPN connection setting will be imported, and then the VPN connection will be started automatically.

Post Reply