From fd55424fbb8a460fb40ee89905da8329c50ff361 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Sun, 2 Jul 2023 22:44:00 +0300 Subject: [PATCH] hotfix --- .../Module/Sophia.psm1 | 27 ++++++++++------- .../Module/Sophia.psm1 | 29 +++++++++++-------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 index 16cef1dfb..2837a2aed 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 @@ -180,6 +180,16 @@ public static string GetString(uint strId) # Detect the OS build version switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) { + {$_ -lt 22000} + { + Write-Warning -Message $Localization.UnsupportedOSBuild + + Start-Process -FilePath "https://t.me/sophia_chat" + Start-Process -FilePath "https://discord.gg/sSryhaEv79" + Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements" + + exit + } {$_ -eq 22000} { if (Test-Path -Path "$env:LOCALAPPDATA\PCHealthCheck\PCHealthCheck.exe") @@ -277,7 +287,7 @@ public static string GetString(uint strId) exit } - {($_ -ge 22621) -and ($_ -le 22624)} + {$_ -eq 22621} { if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 1928) { @@ -313,16 +323,6 @@ public static string GetString(uint strId) exit } } - {$_ -lt 22000} - { - Write-Warning -Message $Localization.UnsupportedOSBuild - - Start-Process -FilePath "https://t.me/sophia_chat" - Start-Process -FilePath "https://discord.gg/sSryhaEv79" - Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements" - - exit - } } # Check the language mode @@ -2297,6 +2297,11 @@ function BrowsingHistory $Show ) + if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 1928) + { + return + } + switch ($PSCmdlet.ParameterSetName) { "Hide" diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 index d6413789d..e19ed4ae2 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 @@ -176,6 +176,16 @@ public static string GetString(uint strId) # Detect the OS build version switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) { + {$_ -lt 22000} + { + Write-Warning -Message $Localization.UnsupportedOSBuild + + Start-Process -FilePath "https://t.me/sophia_chat" + Start-Process -FilePath "https://discord.gg/sSryhaEv79" + Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements" + + exit + } {$_ -eq 22000} { if (Test-Path -Path "$env:LOCALAPPDATA\PCHealthCheck\PCHealthCheck.exe") @@ -273,7 +283,7 @@ public static string GetString(uint strId) exit } - {($_ -ge 22621) -and ($_ -le 22624)} + {$_ -eq 22621} { if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 1928) { @@ -309,16 +319,6 @@ public static string GetString(uint strId) exit } } - {$_ -lt 22000} - { - Write-Warning -Message $Localization.UnsupportedOSBuild - - Start-Process -FilePath "https://t.me/sophia_chat" - Start-Process -FilePath "https://discord.gg/sSryhaEv79" - Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements" - - exit - } } # Check the language mode @@ -2301,6 +2301,11 @@ function BrowsingHistory $Show ) + if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 1928) + { + return + } + switch ($PSCmdlet.ParameterSetName) { "Hide" @@ -10906,7 +10911,7 @@ function UninstallUWPApps $AppxPackages += Get-AppxPackage -Name Disney.37853FC22B2CE -AllUsers:$AllUsers } - $PackagesIds = [Windows.Management.Deployment.PackageManager, Windows.Web, ContentType = WindowsRuntime]::new().FindPackages() | Select-Object -Property DisplayName -ExpandProperty Id | Select-Object -Property Name, DisplayName + $PackagesIds = [Windows.Management.Deployment.PackageManager]::new().FindPackages() | Select-Object -Property DisplayName -ExpandProperty Id | Select-Object -Property Name, DisplayName foreach ($AppxPackage in $AppxPackages) {