Browse Source

Improved downloading th elatest provided script version

pull/658/head
Dmitry Nefedov 8 months ago
parent
commit
a294a19a8e
  1. 22
      Download_Latest_Sophia.ps1
  2. 34
      Download_Sophia.ps1
  3. 2
      src/Sophia_Script_for_Windows_11_ARM/Manifest/SophiaScript.psd1
  4. 2
      src/Sophia_Script_for_Windows_11_ARM/Module/Sophia.psm1
  5. 2
      src/Sophia_Script_for_Windows_11_ARM_PowerShell_7/Module/Sophia.psm1

22
Download_Latest_Sophia.ps1

@ -124,12 +124,12 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
{ {
if ((Get-CimInstance -ClassName CIM_Processor).Caption -match "ARM") 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" $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 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" $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" 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")) 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" Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_PowerShell_7_Latest"

34
Download_Sophia.ps1

@ -155,7 +155,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
$Version = "Windows_10_PowerShell_5.1" $Version = "Windows_10_PowerShell_5_1"
} }
else else
{ {
@ -182,7 +182,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
if ((Get-CimInstance -ClassName CIM_Processor).Caption -match "ARM") if ((Get-CimInstance -ClassName CIM_Processor).Caption -match "ARM")
{ {
# Arm based # Arm based
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_5_1 $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_Arm_PowerShell_5_1
$Parameters = @{ $Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.ARM.v$LatestRelease.zip" 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" OutFile = "$DownloadsFolder\Sophia.Script.zip"
@ -191,7 +191,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
$Version = "Windows_11_PowerShell_5.1" $Version = "Windows_11_Arm_PowerShell_5_1"
} }
else else
{ {
@ -204,7 +204,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
$Version = "Windows_11_PowerShell_5.1" $Version = "Windows_11_PowerShell_5_1"
} }
} }
else else
@ -213,7 +213,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
if ((Get-CimInstance -ClassName CIM_Processor).Caption -match "ARM") if ((Get-CimInstance -ClassName CIM_Processor).Caption -match "ARM")
{ {
# Arm based # Arm based
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_7 $LatestRelease = $JSONVersions.Sophia_Script_Windows_11_Arm_PowerShell_7
$Parameters = @{ $Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.ARM.PowerShell.7.v$LatestRelease.zip" 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" OutFile = "$DownloadsFolder\Sophia.Script.zip"
@ -222,7 +222,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
$Version = "Windows_11_PowerShell_7" $Version = "Windows_11_Arm_PowerShell_7"
} }
else else
{ {
@ -326,7 +326,7 @@ switch ($Version)
Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease" 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" 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" 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" 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" 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 = @{ $Signature = @{

2
src/Sophia_Script_for_Windows_11_ARM/Manifest/SophiaScript.psd1

@ -6,7 +6,7 @@
Copyright = '(c) 2014—2025 Team Sophia. All rights reserved' Copyright = '(c) 2014—2025 Team Sophia. All rights reserved'
Description = 'Module for Windows fine-tuning and automating the routine tasks' Description = 'Module for Windows fine-tuning and automating the routine tasks'
PowerShellVersion = '5.1' PowerShellVersion = '5.1'
ProcessorArchitecture = 'AMD64' ProcessorArchitecture = 'None'
FunctionsToExport = '*' FunctionsToExport = '*'
PrivateData = @{ PrivateData = @{

2
src/Sophia_Script_for_Windows_11_ARM/Module/Sophia.psm1

@ -261,7 +261,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Check CPU architecture # Check CPU architecture
$Caption = (Get-CimInstance -ClassName CIM_Processor).Caption $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-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.UnsupportedArchitecture -f $Caption) Write-Warning -Message ($Localization.UnsupportedArchitecture -f $Caption)

2
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 # Check CPU architecture
$Caption = (Get-CimInstance -ClassName CIM_Processor).Caption $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-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.UnsupportedArchitecture -f $Caption) Write-Warning -Message ($Localization.UnsupportedArchitecture -f $Caption)

Loading…
Cancel
Save