Browse Source

Updated the download function

master
Dmitry Nefedov 2 months ago
parent
commit
8441e46cf2
  1. 49
      Download_Sophia.ps1

49
Download_Sophia.ps1

@ -14,7 +14,7 @@
#> #>
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if ($Host.Version.Major -eq 5) ### if ($Host.Version.Major -eq 5)
{ {
# Progress bar can significantly impact cmdlet performance # Progress bar can significantly impact cmdlet performance
# https://github.com/PowerShell/PowerShell/issues/2138 # https://github.com/PowerShell/PowerShell/issues/2138
@ -126,29 +126,44 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
} }
{$_ -ge 22631} {$_ -ge 22631}
{ {
if ($Host.Version.Major -eq 5) if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS")
{ {
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1 if ($Host.Version.Major -eq 5)
$Parameters = @{ {
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip" $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
OutFile = "$DownloadsFolder\Sophia.Script.zip" $Parameters = @{
UseBasicParsing = $true Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip"
Verbose = $true OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
$Version = "Windows_11_PowerShell_5.1"
}
else
{
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
$Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
$Version = "Windows_11_PowerShell_7"
} }
$Version = "Windows_11_PowerShell_5.1"
} }
else else
{ {
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7 $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024
$Parameters = @{ $Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip" Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip"
OutFile = "$DownloadsFolder\Sophia.Script.zip" OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true UseBasicParsing = $true
Verbose = $true Verbose = $true
} }
$Version = "Windows_11_PowerShell_7" $Version = "LTSC2024"
} }
} }
} }
@ -196,6 +211,14 @@ switch ($Version)
Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease" Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease"
} }
} }
"LTSC2024"
{
Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease"
if ((([System.Security.Principal.WindowsIdentity]::GetCurrent()).Owner -eq "S-1-5-32-544"))
{
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"

Loading…
Cancel
Save