Browse Source

Updated the download function

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

25
Download_Sophia.ps1

@ -14,7 +14,7 @@
#>
[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
# https://github.com/PowerShell/PowerShell/issues/2138
@ -125,6 +125,8 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
}
}
{$_ -ge 22631}
{
if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS")
{
if ($Host.Version.Major -eq 5)
{
@ -151,6 +153,19 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
$Version = "Windows_11_PowerShell_7"
}
}
else
{
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024
$Parameters = @{
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"
UseBasicParsing = $true
Verbose = $true
}
$Version = "LTSC2024"
}
}
}
Invoke-WebRequest @Parameters
@ -196,6 +211,14 @@ switch ($Version)
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"
{
Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_v$LatestRelease"

Loading…
Cancel
Save