This repository has been archived by the owner on May 28, 2020. It is now read-only.
forked from richardhicks/aovpn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnable-VpnServerIKEv2Fragmentation.ps1
149 lines (122 loc) · 6.64 KB
/
Enable-VpnServerIKEv2Fragmentation.ps1
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<#
.SYNOPSIS
Enable IKEv2 fragmentation support on Windows Server 1803 and later operating systems.
.PARAMETER Restart
Restarts the RemoteAccess service.
.EXAMPLE
.\Enable-IKEv2VPNFragmentation.ps1
.DESCRIPTION
Create a registry entry to enable IKEv2 fragmentation support on Windows Server 1803 and later operating systmes.
.LINK
https://directaccess.richardhicks.com/2019/02/11/always-on-vpn-and-ikev2-fragmentation/
.NOTES
Version: 1.1
Creation Date: August 3, 2019
Last Updated: January 25, 2020
Author: Richard Hicks
Organization: Richard M. Hicks Consulting, Inc.
Contact: [email protected]
Web Site: www.richardhicks.com
#>
[CmdletBinding()]
Param (
[switch]$Restart
)
$OSVersion = (Get-CimInstance 'Win32_OperatingSystem').Version
# Must be running Windows Server 1803 or later to support IKEv2 fragmentation. Abort script if earlier release is detected.
If ($OSVersion -lt '10.0.17134') {
Write-Warning 'IKEv2 VPN fragmentation is only supported on Windows Server 1803 (10.0.17134) or later operating systems. Exiting script.'
Exit
}
# Registry settings
$Parameters = @{
Path = 'HKLM:\SYSTEM\CurrentControlSet\Services\RemoteAccess\Parameters\Ikev2\'
Name = 'EnableServerFragmentation'
PropertyType = 'DWORD'
Value = '1'
}
Write-Verbose 'Adding registry entry to enable IKEv2 fragmentation support...'
# Update registry
New-ItemProperty @Parameters -Force
# Restart RemoteAccess service
If ($Restart) {
Write-Verbose 'Restarting the RemoteAccess service...'
Restart-Service RemoteAccess -PassThru
}
Else {
Write-Warning 'The RemoteAccess service must be restarted for these changes to take effect.'
}
# SIG # Begin signature block
# MIINbAYJKoZIhvcNAQcCoIINXTCCDVkCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUgA/DkU/oX7l7CuV3atV2XMKD
# Ap6gggquMIIFMDCCBBigAwIBAgIQBAkYG1/Vu2Z1U0O1b5VQCDANBgkqhkiG9w0B
# AQsFADBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD
# VQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVk
# IElEIFJvb3QgQ0EwHhcNMTMxMDIyMTIwMDAwWhcNMjgxMDIyMTIwMDAwWjByMQsw
# CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu
# ZGlnaWNlcnQuY29tMTEwLwYDVQQDEyhEaWdpQ2VydCBTSEEyIEFzc3VyZWQgSUQg
# Q29kZSBTaWduaW5nIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
# +NOzHH8OEa9ndwfTCzFJGc/Q+0WZsTrbRPV/5aid2zLXcep2nQUut4/6kkPApfmJ
# 1DcZ17aq8JyGpdglrA55KDp+6dFn08b7KSfH03sjlOSRI5aQd4L5oYQjZhJUM1B0
# sSgmuyRpwsJS8hRniolF1C2ho+mILCCVrhxKhwjfDPXiTWAYvqrEsq5wMWY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