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 ?
Import configuration file client_VPN.vpn with powershell
-
- Posts: 2
- Joined: Tue Jun 20, 2023 10:24 am
-
- Posts: 2
- Joined: Tue Jun 20, 2023 10:24 am
Re: Import configuration file client_VPN.vpn with powershell
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: $_"
}
}
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: $_"
}
}
-
- Posts: 1287
- Joined: Sun Feb 14, 2021 10:31 am
Re: Import configuration file client_VPN.vpn with powershell
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.