From a294a19a8e28d52575dc6c4ecc012f39787b3594 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Mon, 4 Aug 2025 22:37:28 +0300 Subject: [PATCH] Improved downloading th elatest provided script version --- Download_Latest_Sophia.ps1 | 22 ++++++++++-- Download_Sophia.ps1 | 34 ++++++++++++++----- .../Manifest/SophiaScript.psd1 | 2 +- .../Module/Sophia.psm1 | 2 +- .../Module/Sophia.psm1 | 2 +- 5 files changed, 49 insertions(+), 13 deletions(-) diff --git a/Download_Latest_Sophia.ps1 b/Download_Latest_Sophia.ps1 index f5773f54..0953311d 100644 --- a/Download_Latest_Sophia.ps1 +++ b/Download_Latest_Sophia.ps1 @@ -124,12 +124,12 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) { if ((Get-CimInstance -ClassName CIM_Processor).Caption -match "ARM") { - $Version = "Sophia_Script_for_Windows_11_ARM" + $Version = "Windows_11_PowerShell_5_1" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 (Arm) | Latest | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2025" } else { - $Version = "Sophia_Script_for_Windows_11" + $Version = "Windows_11_Arm_PowerShell_5_1" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 | Latest | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2025" } } @@ -321,6 +321,24 @@ switch ($Version) { Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_PowerShell_7_Latest" + if ((([System.Security.Principal.WindowsIdentity]::GetCurrent()).Owner -eq "S-1-5-32-544")) + { + Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_PowerShell_7_Latest" + } + } + "Sophia_Script_for_Windows_11_Arm_PowerShell_5_1" + { + Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_Arm_Latest" + + if ((([System.Security.Principal.WindowsIdentity]::GetCurrent()).Owner -eq "S-1-5-32-544")) + { + Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_PowerShell_7_Latest" + } + } + "Sophia_Script_for_Windows_11_Arm_PowerShell_7" + { + Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_Arm_PowerShell_7_Latest" + if ((([System.Security.Principal.WindowsIdentity]::GetCurrent()).Owner -eq "S-1-5-32-544")) { Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_PowerShell_7_Latest" diff --git a/Download_Sophia.ps1 b/Download_Sophia.ps1 index 96e00ff9..178fb218 100644 --- a/Download_Sophia.ps1 +++ b/Download_Sophia.ps1 @@ -155,7 +155,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) } Invoke-WebRequest @Parameters - $Version = "Windows_10_PowerShell_5.1" + $Version = "Windows_10_PowerShell_5_1" } else { @@ -182,7 +182,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) if ((Get-CimInstance -ClassName CIM_Processor).Caption -match "ARM") { # Arm based - $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_5_1 + $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_Arm_PowerShell_5_1 $Parameters = @{ Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.ARM.v$LatestRelease.zip" OutFile = "$DownloadsFolder\Sophia.Script.zip" @@ -191,7 +191,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) } Invoke-WebRequest @Parameters - $Version = "Windows_11_PowerShell_5.1" + $Version = "Windows_11_Arm_PowerShell_5_1" } else { @@ -204,7 +204,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) } Invoke-WebRequest @Parameters - $Version = "Windows_11_PowerShell_5.1" + $Version = "Windows_11_PowerShell_5_1" } } else @@ -213,7 +213,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) if ((Get-CimInstance -ClassName CIM_Processor).Caption -match "ARM") { # Arm based - $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_7 + $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_Arm_PowerShell_7 $Parameters = @{ Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.ARM.PowerShell.7.v$LatestRelease.zip" OutFile = "$DownloadsFolder\Sophia.Script.zip" @@ -222,7 +222,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) } Invoke-WebRequest @Parameters - $Version = "Windows_11_PowerShell_7" + $Version = "Windows_11_Arm_PowerShell_7" } else { @@ -326,7 +326,7 @@ switch ($Version) Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease" } } - "Windows_10_PowerShell_5.1" + "Windows_10_PowerShell_5_1" { Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_v$LatestRelease" @@ -344,7 +344,7 @@ switch ($Version) Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease" } } - "Windows_11_PowerShell_5.1" + "Windows_11_PowerShell_5_1" { Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_v$LatestRelease" @@ -362,6 +362,24 @@ switch ($Version) Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease" } } + "Windows_11_Arm_PowerShell_5_1" + { + Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_Arm_v$LatestRelease" + + if ((([System.Security.Principal.WindowsIdentity]::GetCurrent()).Owner -eq "S-1-5-32-544")) + { + Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_Arm_v$LatestRelease" + } + } + "Windows_11_Arm_PowerShell_7" + { + Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_Arm_PowerShell_7_v$LatestRelease" + + if ((([System.Security.Principal.WindowsIdentity]::GetCurrent()).Owner -eq "S-1-5-32-544")) + { + Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_Arm_PowerShell_7_v$LatestRelease" + } + } } $Signature = @{ diff --git a/src/Sophia_Script_for_Windows_11_ARM/Manifest/SophiaScript.psd1 b/src/Sophia_Script_for_Windows_11_ARM/Manifest/SophiaScript.psd1 index 8dab0e57..0b69f821 100644 --- a/src/Sophia_Script_for_Windows_11_ARM/Manifest/SophiaScript.psd1 +++ b/src/Sophia_Script_for_Windows_11_ARM/Manifest/SophiaScript.psd1 @@ -6,7 +6,7 @@ Copyright = '(c) 2014—2025 Team Sophia. All rights reserved' Description = 'Module for Windows fine-tuning and automating the routine tasks' PowerShellVersion = '5.1' - ProcessorArchitecture = 'AMD64' + ProcessorArchitecture = 'None' FunctionsToExport = '*' PrivateData = @{ diff --git a/src/Sophia_Script_for_Windows_11_ARM/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_ARM/Module/Sophia.psm1 index b3202e69..06a81178 100644 --- a/src/Sophia_Script_for_Windows_11_ARM/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_ARM/Module/Sophia.psm1 @@ -261,7 +261,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Check CPU architecture $Caption = (Get-CimInstance -ClassName CIM_Processor).Caption - if (($Caption -notmatch "AMD64") -and ($Caption -notmatch "Intel64")) + if ($Caption -notmatch "Arm") { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.UnsupportedArchitecture -f $Caption) diff --git a/src/Sophia_Script_for_Windows_11_ARM_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_ARM_PowerShell_7/Module/Sophia.psm1 index 684cdaf8..6b55e9bc 100644 --- a/src/Sophia_Script_for_Windows_11_ARM_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_ARM_PowerShell_7/Module/Sophia.psm1 @@ -274,7 +274,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Check CPU architecture $Caption = (Get-CimInstance -ClassName CIM_Processor).Caption - if (($Caption -notmatch "AMD64") -and ($Caption -notmatch "Intel64")) + if ($Caption -notmatch "Arm") { Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message ($Localization.UnsupportedArchitecture -f $Caption)