Skip to content

Commit

Permalink
Updated the download function
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 committed Oct 18, 2024
1 parent 20387b6 commit 8441e46
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions Download_Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -126,29 +126,44 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
}
{$_ -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
$Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip"
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
if ($Host.Version.Major -eq 5)
{
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
$Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip"
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
{
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
$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.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"
UseBasicParsing = $true
Verbose = $true
}

$Version = "Windows_11_PowerShell_7"
$Version = "LTSC2024"
}
}
}
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 8441e46

Please sign in to comment.