Skip to content

Commit

Permalink
Fixed wrong check for Windows 11 LTSC
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 committed Oct 7, 2024
1 parent 1a1ecb9 commit 2c05925
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
9 changes: 3 additions & 6 deletions src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
27 changes: 19 additions & 8 deletions src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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]
{
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion supported_windows_builds.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 2c05925

Please sign in to comment.