From 2c05925e78e63bfc2f52ed25559addc6de44d642 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Mon, 7 Oct 2024 21:22:46 +0300 Subject: [PATCH] Fixed wrong check for Windows 11 LTSC --- .../Module/Sophia.psm1 | 9 +++---- .../Module/Sophia.psm1 | 9 +++---- .../Module/Sophia.psm1 | 27 +++++++++++++------ supported_windows_builds.json | 4 ++- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 index d453260e..39ca0853 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 @@ -580,7 +580,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Detect Windows build version - if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS") + if ((Get-WindowsEdition -Online).Edition -ne "EnterpriseS") { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message $Localization.UnsupportedOSBuild @@ -1344,11 +1344,8 @@ function ErrorReporting { "Disable" { - if ((Get-WindowsEdition -Online).Edition -notmatch "Core") - { - Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask - New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force - } + Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask + New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force Get-Service -Name WerSvc | Stop-Service -Force Get-Service -Name WerSvc | Set-Service -StartupType Disabled diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 index 8bc566ad..36adaabf 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 @@ -580,7 +580,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Detect Windows build version - if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS") + if ((Get-WindowsEdition -Online).Edition -ne "EnterpriseS") { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message $Localization.UnsupportedOSBuild @@ -1344,11 +1344,8 @@ function ErrorReporting { "Disable" { - if ((Get-WindowsEdition -Online).Edition -notmatch "Core") - { - Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask - New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force - } + Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask + New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force Get-Service -Name WerSvc | Stop-Service -Force Get-Service -Name WerSvc | Set-Service -StartupType Disabled diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 index 83799b18..71ce7946 100644 --- a/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 @@ -577,10 +577,24 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } + # Detect Windows build version + if ((Get-WindowsEdition -Online).Edition -ne "EnterpriseS") + { + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.UnsupportedOSBuild + Write-Information -MessageData "" -InformationAction Continue + + Write-Verbose -Message "https://t.me/sophia_chat" -Verbose + Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose + Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements" -Verbose + + exit + } + # Detect Windows build version switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) { - {$_ -lt 22631} + {$_ -ne 26100} { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message $Localization.UnsupportedOSBuild @@ -601,7 +615,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } - "22631" + "26100" { # Check whether the current module version is the latest one try @@ -626,7 +640,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); Verbose = $true UseBasicParsing = $true } - $LatestSupportedBuild = (Invoke-RestMethod @Parameters).Windows_11 + $LatestSupportedBuild = (Invoke-RestMethod @Parameters).Windows_11_LTSC_2024 } catch [System.Net.WebException] { @@ -1333,11 +1347,8 @@ function ErrorReporting { "Disable" { - if ((Get-WindowsEdition -Online).Edition -notmatch "Core") - { - Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask - New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force - } + Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask + New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force Get-Service -Name WerSvc | Stop-Service -Force Get-Service -Name WerSvc | Set-Service -StartupType Disabled diff --git a/supported_windows_builds.json b/supported_windows_builds.json index 4d0f4b0d..8a9413bb 100644 --- a/supported_windows_builds.json +++ b/supported_windows_builds.json @@ -6,5 +6,7 @@ "Windows_10_LTSC_2021_URL": "https://support.microsoft.com/en-us/topic/windows-10-update-history-857b8ccb-71e4-49e5-b3f6-7073197d98fb", "Windows_10_LTSC_2021": "4894", "Windows_11_URL": "https://support.microsoft.com/en-us/topic/windows-11-version-23h2-update-history-59875222-b990-4bd9-932f-91a5954de434", - "Windows_11": "4169" + "Windows_11": "4169", + "Windows_11_LTSC_2024_URL": "https://support.microsoft.com/en-us/topic/windows-11-version-24h2-update-history-0929c747-1815-4543-8461-0160d16f15e5", + "Windows_11_LTSC_2024": "1742" }