Skip to content

Commit

Permalink
chore: exclude 65330 in building 23H2 VHDs (#4220)
Browse files Browse the repository at this point in the history
  • Loading branch information
junjiezhang1997 authored Apr 7, 2024
1 parent d70ff99 commit 567059a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
17 changes: 16 additions & 1 deletion vhdbuilder/packer/configure-windows-vhd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ function Update-Registry {
}
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Policies\Microsoft\FeatureManagement\Overrides" -Name 2629306509 -Value 1 -Type DWORD

Write-Log "Enable 4 fixes in 2023-04B"
Write-Log "Enable 4 fixes in 2023-04B"
$currentValue=(Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\hns\State" -Name HnsPolicyUpdateChange -ErrorAction Ignore)
if (![string]::IsNullOrEmpty($currentValue)) {
Write-Log "The current value of HnsPolicyUpdateChange is $currentValue"
Expand Down Expand Up @@ -823,6 +823,21 @@ function Update-Registry {
}
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Policies\Microsoft\FeatureManagement\Overrides" -Name 124082829 -Value 1 -Type DWORD
}

if ($env:WindowsSKU -Like '23H2*') {
$currentValue=(Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\hns\State" -Name NamespaceExcludedUdpPorts -ErrorAction Ignore)
if (![string]::IsNullOrEmpty($currentValue)) {
Write-Log "The current value of NamespaceExcludedUdpPorts is $currentValue"
}
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\hns\State" -Name NamespaceExcludedUdpPorts -Value 65330 -Type REG_SZ

$currentValue=(Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\hns\State" -Name PortExclusionChange -ErrorAction Ignore)
if (![string]::IsNullOrEmpty($currentValue)) {
Write-Log "The current value of PortExclusionChange is $currentValue"
}
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\hns\State" -Name PortExclusionChange -Value 1 -Type DWORD

}
}

function Get-SystemDriveDiskInfo {
Expand Down
12 changes: 12 additions & 0 deletions vhdbuilder/packer/test/windows-vhd-content-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,18 @@ function Test-RegistryAdded {
exit 1
}
}
if ($env:WindowsSKU -Like '23H2*') {
$result=(Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\hns\State" -Name NamespaceExcludedUdpPorts)
if ($result.NamespaceExcludedUdpPorts -ne 65330) {
Write-ErrorWithTimestamp "The registry for NamespaceExcludedUdpPorts is not added"
exit 1
}
$result=(Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\hns\State" -Name PortExclusionChange)
if ($result.PortExclusionChange -ne 1) {
Write-ErrorWithTimestamp "The registry for PortExclusionChange is not added"
exit 1
}
}
}

function Test-DefenderSignature {
Expand Down
4 changes: 3 additions & 1 deletion vhdbuilder/packer/write-release-notes-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ $wuRegistryNames = @(
"1114842764",
"HnsPreallocatePortRange",
"4154935436",
"124082829"
"124082829",
"NamespaceExcludedUdpPorts",
"PortExclusionChange"
)

foreach ($key in $wuRegistryKeys) {
Expand Down

0 comments on commit 567059a

Please sign in to comment.