Skip to content

Commit 2c05925

Browse files
committed
Fixed wrong check for Windows 11 LTSC
1 parent 1a1ecb9 commit 2c05925

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
580580
}
581581

582582
# Detect Windows build version
583-
if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS")
583+
if ((Get-WindowsEdition -Online).Edition -ne "EnterpriseS")
584584
{
585585
Write-Information -MessageData "" -InformationAction Continue
586586
Write-Warning -Message $Localization.UnsupportedOSBuild
@@ -1344,11 +1344,8 @@ function ErrorReporting
13441344
{
13451345
"Disable"
13461346
{
1347-
if ((Get-WindowsEdition -Online).Edition -notmatch "Core")
1348-
{
1349-
Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask
1350-
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force
1351-
}
1347+
Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask
1348+
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force
13521349

13531350
Get-Service -Name WerSvc | Stop-Service -Force
13541351
Get-Service -Name WerSvc | Set-Service -StartupType Disabled

src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
580580
}
581581

582582
# Detect Windows build version
583-
if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS")
583+
if ((Get-WindowsEdition -Online).Edition -ne "EnterpriseS")
584584
{
585585
Write-Information -MessageData "" -InformationAction Continue
586586
Write-Warning -Message $Localization.UnsupportedOSBuild
@@ -1344,11 +1344,8 @@ function ErrorReporting
13441344
{
13451345
"Disable"
13461346
{
1347-
if ((Get-WindowsEdition -Online).Edition -notmatch "Core")
1348-
{
1349-
Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask
1350-
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force
1351-
}
1347+
Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask
1348+
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force
13521349

13531350
Get-Service -Name WerSvc | Stop-Service -Force
13541351
Get-Service -Name WerSvc | Set-Service -StartupType Disabled

src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,24 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
577577
exit
578578
}
579579

580+
# Detect Windows build version
581+
if ((Get-WindowsEdition -Online).Edition -ne "EnterpriseS")
582+
{
583+
Write-Information -MessageData "" -InformationAction Continue
584+
Write-Warning -Message $Localization.UnsupportedOSBuild
585+
Write-Information -MessageData "" -InformationAction Continue
586+
587+
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
588+
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
589+
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements" -Verbose
590+
591+
exit
592+
}
593+
580594
# Detect Windows build version
581595
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber)
582596
{
583-
{$_ -lt 22631}
597+
{$_ -ne 26100}
584598
{
585599
Write-Information -MessageData "" -InformationAction Continue
586600
Write-Warning -Message $Localization.UnsupportedOSBuild
@@ -601,7 +615,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
601615

602616
exit
603617
}
604-
"22631"
618+
"26100"
605619
{
606620
# Check whether the current module version is the latest one
607621
try
@@ -626,7 +640,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
626640
Verbose = $true
627641
UseBasicParsing = $true
628642
}
629-
$LatestSupportedBuild = (Invoke-RestMethod @Parameters).Windows_11
643+
$LatestSupportedBuild = (Invoke-RestMethod @Parameters).Windows_11_LTSC_2024
630644
}
631645
catch [System.Net.WebException]
632646
{
@@ -1333,11 +1347,8 @@ function ErrorReporting
13331347
{
13341348
"Disable"
13351349
{
1336-
if ((Get-WindowsEdition -Online).Edition -notmatch "Core")
1337-
{
1338-
Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask
1339-
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force
1340-
}
1350+
Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask
1351+
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force
13411352

13421353
Get-Service -Name WerSvc | Stop-Service -Force
13431354
Get-Service -Name WerSvc | Set-Service -StartupType Disabled

supported_windows_builds.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
"Windows_10_LTSC_2021_URL": "https://support.microsoft.com/en-us/topic/windows-10-update-history-857b8ccb-71e4-49e5-b3f6-7073197d98fb",
77
"Windows_10_LTSC_2021": "4894",
88
"Windows_11_URL": "https://support.microsoft.com/en-us/topic/windows-11-version-23h2-update-history-59875222-b990-4bd9-932f-91a5954de434",
9-
"Windows_11": "4169"
9+
"Windows_11": "4169",
10+
"Windows_11_LTSC_2024_URL": "https://support.microsoft.com/en-us/topic/windows-11-version-24h2-update-history-0929c747-1815-4543-8461-0160d16f15e5",
11+
"Windows_11_LTSC_2024": "1742"
1012
}

0 commit comments

Comments
 (0)