Skip to content

Instantly share code, notes, and snippets.

@JCotton1123
Created November 6, 2014 04:42
Show Gist options
  • Save JCotton1123/88e3c196c2066eda5326 to your computer and use it in GitHub Desktop.
Save JCotton1123/88e3c196c2066eda5326 to your computer and use it in GitHub Desktop.
Windows OpenVPN installer
; Automated installer for OpenVPN
; The MIT License (MIT)
;
; Copyright (c) 2014 Jesse Cotton <jcotton1123@gmail.com>
;
; 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.
#include <Constants.au3>
#include <FileConstants.au3>
; Disable annoying tray icon
Opt("TrayIconHide", 1)
; Script requires admin privileges
#requireadmin
Const $REINSTALL_OPENVPN = False
Const $WIPE_EXISTING_CONFS = True
FileInstall("splash.jpg", @TempDir & '\', $FC_OVERWRITE)
SplashImageOn("VPN Installer", @TempDir & '\splash.jpg', 653, 300, -1, -1, $DLG_NOTONTOP + $DLG_MOVEABLE)
; Embed/extract files
FileInstall("openvpn-install-x32.exe", @TempDir & '\', $FC_OVERWRITE);
FileInstall("openvpn-install-x64.exe", @TempDir & '\', $FC_OVERWRITE);
; Install OpenVPN
If $REINSTALL_OPENVPN Or Not FileExists(@ProgramFilesDir & "\OpenVPN") Then
Local $installer='openvpn-install-x32.exe'
If @OSArch = "X64" then
$installer='openvpn-install-x64.exe'
EndIf
Local $installerPath = @TempDir & '\' & $installer
RunWait($installerPath & ' /S','',@SW_HIDE,2)
EndIf
; Install configs
Local $ovpnConfDir = @ProgramFilesDir & "\OpenVPN\config\"
If $WIPE_EXISTING_CONFS Then
FileDelete($ovpnConfDir)
EndIf
FileInstall("organization.ovpn", $ovpnConfDir, $FC_OVERWRITE + $FC_CREATEPATH);
FileInstall("organization.client.key", $ovpnConfDir, $FC_OVERWRITE + $FC_CREATEPATH);
FileInstall("organization.client.crt",$ovpnConfDir, $FC_OVERWRITE + $FC_CREATEPATH);
FileInstall("organization.ca.crt", $ovpnConfDir, $FC_OVERWRITE + $FC_CREATEPATH);
SplashOff()
; Make >= Vista happy
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment