Skip to content

Commit

Permalink
chore(deps): bump windows 11 to 22h2 september 2022 (vmware-samples#284)
Browse files Browse the repository at this point in the history
- Bumps Windows 11 to the 22H2 September 2022 release.
- Updates the `./scripts/windows/windows-init.ps1` to be more succinct work with Windows 11 22H2. Tested with each Windows option in the project.

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
tenthirtyam committed Sep 28, 2022
1 parent d555497 commit 10d1316
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
6 changes: 3 additions & 3 deletions builds/windows/desktop/11/windows.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Installation Operating System Metadata
vm_inst_os_language = "en-US"
vm_inst_os_keyboard = "en-US"
vm_inst_os_image = "Windows 10 Pro" // Must be of `Windows 10`
vm_inst_os_image = "Windows 11 Pro"
vm_inst_os_kms_key = "W269N-WFGWX-YVC9B-4J6C9-T83GX"

// Guest Operating System Metadata
Expand Down Expand Up @@ -40,9 +40,9 @@ vm_video_displays = 1
// Removable Media Settings
iso_url = null
iso_path = "iso/windows/desktop"
iso_file = "en-us_windows_11_business_editions_version_21h2_updated_aug_2022_x64_dvd_50c9cab3.iso"
iso_file = "en-us_windows_11_business_editions_version_22h2_x64_dvd_17a08ce3.iso"
iso_checksum_type = "sha256"
iso_checksum_value = "8B5FE1C2FDB14BD9561460D976E9040FBB7B3CEEDF9DD20FFA1CD9984C6286A0"
iso_checksum_value = "6E3A101C6E97D8E68F576DDBCED9BE34CBA949F750DA3C83F7D4791401068C9F"

// Boot Settings
vm_boot_order = "disk,cdrom"
Expand Down
34 changes: 15 additions & 19 deletions scripts/windows/windows-init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,28 @@
Enables Windows Remote Management on Windows builds.
#>

$ErrorActionPreference = "Stop"
$ErrorActionPreference = 'Stop'

# Enable Windows Remote Management in the Windows Firewall.
Write-Output "Enabling Windows Remote Management in the Windows Firewall..."
$NetworkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
$Connections = $NetworkListManager.GetNetworkConnections()
$Connections | ForEach-Object { $_.GetNetwork().SetCategory(1) }
# Set network connections provile to Private mode.
Write-Output 'Setting the network connection profiles to Private...'
$connectionProfile = Get-NetConnectionProfile
While ($connectionProfile.Name -eq 'Identifying...') {
Start-Sleep -Seconds 10
$connectionProfile = Get-NetConnectionProfile
}
Set-NetConnectionProfile -Name $connectionProfile.Name -NetworkCategory Private

# Set the Windows Remote Management configuration.
Write-Output "Setting the Windows Remote Management configuration..."
Enable-PSRemoting -Force
winrm quickconfig -q
winrm quickconfig -transport:http
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="800"}'
Write-Output 'Setting the Windows Remote Management configuration...'
winrm quickconfig -quiet
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/client/auth '@{Basic="true"}'
winrm set winrm/config/listener?Address=*+Transport=HTTP '@{Port="5985"}'

# Allow Windows Remote Management in the Windows Firewall.
Write-Output "Allowing Windows Remote Management in the Windows Firewall..."
Write-Output 'Allowing Windows Remote Management in the Windows Firewall...'
netsh advfirewall firewall set rule group="Windows Remote Administration" new enable=yes
netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" new enable=yes action=allow

# Restart Windows Remote Management service.
Write-Output "Restarting Windows Remote Management service..."
Set-Service winrm -startuptype "auto"
Restart-Service winrm
# Reset the autologon count.
# Reference: https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-autologon-logoncount#logoncount-known-issue
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoLogonCount -Value 0

0 comments on commit 10d1316

Please sign in to comment.