Browse Source

Fixed wrong check for Windows 11 LTSC

master 6.7.0
Dmitry Nefedov 3 months ago
parent
commit
2c05925e78
  1. 9
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  2. 9
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  3. 27
      src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1
  4. 4
      supported_windows_builds.json

9
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 # Detect Windows build version
if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS") if ((Get-WindowsEdition -Online).Edition -ne "EnterpriseS")
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.UnsupportedOSBuild Write-Warning -Message $Localization.UnsupportedOSBuild
@ -1344,11 +1344,8 @@ function ErrorReporting
{ {
"Disable" "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 | Stop-Service -Force
Get-Service -Name WerSvc | Set-Service -StartupType Disabled Get-Service -Name WerSvc | Set-Service -StartupType Disabled

9
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 # Detect Windows build version
if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS") if ((Get-WindowsEdition -Online).Edition -ne "EnterpriseS")
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.UnsupportedOSBuild Write-Warning -Message $Localization.UnsupportedOSBuild
@ -1344,11 +1344,8 @@ function ErrorReporting
{ {
"Disable" "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 | Stop-Service -Force
Get-Service -Name WerSvc | Set-Service -StartupType Disabled Get-Service -Name WerSvc | Set-Service -StartupType Disabled

27
src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

@ -577,10 +577,24 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
exit 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 # Detect Windows build version
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber)
{ {
{$_ -lt 22631} {$_ -ne 26100}
{ {
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.UnsupportedOSBuild Write-Warning -Message $Localization.UnsupportedOSBuild
@ -601,7 +615,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
exit exit
} }
"22631" "26100"
{ {
# Check whether the current module version is the latest one # Check whether the current module version is the latest one
try try
@ -626,7 +640,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Verbose = $true Verbose = $true
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestSupportedBuild = (Invoke-RestMethod @Parameters).Windows_11 $LatestSupportedBuild = (Invoke-RestMethod @Parameters).Windows_11_LTSC_2024
} }
catch [System.Net.WebException] catch [System.Net.WebException]
{ {
@ -1333,11 +1347,8 @@ function ErrorReporting
{ {
"Disable" "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 | Stop-Service -Force
Get-Service -Name WerSvc | Set-Service -StartupType Disabled Get-Service -Name WerSvc | Set-Service -StartupType Disabled

4
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_URL": "https://support.microsoft.com/en-us/topic/windows-10-update-history-857b8ccb-71e4-49e5-b3f6-7073197d98fb",
"Windows_10_LTSC_2021": "4894", "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_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"
} }

Loading…
Cancel
Save