Skip to content

Commit 8441e46

Browse files
committed
Updated the download function
1 parent 20387b6 commit 8441e46

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

Download_Sophia.ps1

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#>
1515
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
1616

17-
if ($Host.Version.Major -eq 5) ###
17+
if ($Host.Version.Major -eq 5)
1818
{
1919
# Progress bar can significantly impact cmdlet performance
2020
# https://github.com/PowerShell/PowerShell/issues/2138
@@ -126,29 +126,44 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
126126
}
127127
{$_ -ge 22631}
128128
{
129-
if ($Host.Version.Major -eq 5)
129+
if ((Get-WindowsEdition -Online).Edition -notmatch "EnterpriseS")
130130
{
131-
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
132-
$Parameters = @{
133-
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip"
134-
OutFile = "$DownloadsFolder\Sophia.Script.zip"
135-
UseBasicParsing = $true
136-
Verbose = $true
131+
if ($Host.Version.Major -eq 5)
132+
{
133+
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
134+
$Parameters = @{
135+
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip"
136+
OutFile = "$DownloadsFolder\Sophia.Script.zip"
137+
UseBasicParsing = $true
138+
Verbose = $true
139+
}
140+
141+
$Version = "Windows_11_PowerShell_5.1"
142+
}
143+
else
144+
{
145+
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
146+
$Parameters = @{
147+
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
148+
OutFile = "$DownloadsFolder\Sophia.Script.zip"
149+
UseBasicParsing = $true
150+
Verbose = $true
151+
}
152+
153+
$Version = "Windows_11_PowerShell_7"
137154
}
138-
139-
$Version = "Windows_11_PowerShell_5.1"
140155
}
141156
else
142157
{
143-
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
158+
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024
144159
$Parameters = @{
145-
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
160+
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip"
146161
OutFile = "$DownloadsFolder\Sophia.Script.zip"
147162
UseBasicParsing = $true
148163
Verbose = $true
149164
}
150165

151-
$Version = "Windows_11_PowerShell_7"
166+
$Version = "LTSC2024"
152167
}
153168
}
154169
}
@@ -196,6 +211,14 @@ switch ($Version)
196211
Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease"
197212
}
198213
}
214+
"LTSC2024"
215+
{
216+
Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease"
217+
if ((([System.Security.Principal.WindowsIdentity]::GetCurrent()).Owner -eq "S-1-5-32-544"))
218+
{
219+
Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease"
220+
}
221+
}
199222
"Windows_10_PowerShell_5.1"
200223
{
201224
Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_v$LatestRelease"

0 commit comments

Comments
 (0)