-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathOpenVPNInstall.ps1
More file actions
55 lines (44 loc) · 1.33 KB
/
OpenVPNInstall.ps1
File metadata and controls
55 lines (44 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
param(
[Parameter(Position=0)][Array]$Files
)
$InstallFile = Get-ChildItem OpenVPN*.msi
Start-Process msiexec.exe -ArgumentList "/I $($InstallFile.FullName) /qn /norestart" -Wait -NoNewWindow
if($InstallFile -match "x86"){
$Destination = "C:\Program Files (x86)\OpenVPN\Config"
}else{
$Destination = "C:\Program Files\OpenVPN\Config"
}
if(-not $Files){
$Files = Get-ChildItem *.ovpn -Recurse
}
foreach($File in $Files){
Move-Item $File -Destination $Destination
}
<#
.SYNOPSIS
Will install OpenVPN onto the device and add the configuration files
.DESCRIPTION
Installs OpenVPN using the msi and copies all mentionned ovpn files
to the Program Files config folder, depending on the installed program
architecture.
If none are supplied, the script will look for available ".ovpn" files
at the script root.
.PARAMETER Files
Array containing the configuration files you wish to copy.
.EXAMPLE
PS> OpenVPNInstall.ps1 Config1.ovpn,Config2.ovpn
.EXAMPLE
PS> OpenVPNInstall.ps1 -Files Config1.ovpn
.EXAMPLE
PS> OpenVPNInstall.ps1
.LINK
OpenVPN msi download : https://openvpn.net/community-downloads/
.LINK
Get-ChildItem
.LINK
Move-Item
.LINK
Start-Process
.LINK
msiexec.exe
#>