Browse Source

Update Download_Sophia.ps1

pull/305/head
Dmitry Nefedov 3 years ago
committed by GitHub
parent
commit
57aeeebaba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 39
      Download_Sophia.ps1

39
Download_Sophia.ps1

@ -3,7 +3,7 @@
Download the latest Sophia Script version, depending on what Windows or PowerShell versions are used to Download the latest Sophia Script version, depending on what Windows or PowerShell versions are used to
E.g., if you start script on Windows 11 via PowerShell 5.1 you will start downloading Sophia Script for Windows 11 PowerShell 5.1 E.g., if you start script on Windows 11 via PowerShell 5.1 you will start downloading Sophia Script for Windows 11 PowerShell 5.1
.EXAMPLE Download and expand the Sophia Script archive .EXAMPLE Download and the Sophia Script archive
irm script.sophi.app | iex irm script.sophi.app | iex
.EXAMPLE Download and expand the Wrapper archive .EXAMPLE Download and expand the Wrapper archive
@ -68,19 +68,40 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
UseBasicParsing = $true UseBasicParsing = $true
} }
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC $LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2019
$Parameters = @{ $Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.v$LatestRelease.zip" Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
OutFile = "$DownloadsFolder\Sophia.Script.zip" OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true UseBasicParsing = $true
Verbose = $true Verbose = $true
} }
$Version = "LTSC" $Version = "LTSC2019"
break
} }
{($_ -ge 19041) -and ($_ -le 19044)} {($_ -ge 19041) -and ($_ -le 19044)}
{ {
if ($PSVersionTable.PSVersion.Major -eq 5) if ($PSVersionTable.PSVersion.Major -eq 5)
{
# Check if Windows 10 is an LTSC 2021
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -eq "Windows 10 Enterprise LTSC 2021")
{
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
UseBasicParsing = $true
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2021
$Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip"
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
$Version = "LTSC2021"
}
else
{ {
$Parameters = @{ $Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
@ -96,6 +117,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
$Version = "Windows_10_PowerShell_5.1" $Version = "Windows_10_PowerShell_5.1"
} }
}
else else
{ {
$Parameters = @{ $Parameters = @{
@ -112,6 +134,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
$Version = "Windows_10_PowerShell_7" $Version = "Windows_10_PowerShell_7"
} }
} }
"22000" "22000"
{ {
@ -168,9 +191,13 @@ switch ($Version)
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script Wrapper v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia Script Wrapper v$LatestRelease"
} }
"LTSC" "LTSC2019"
{
Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 10 LTSC 2019 v$LatestRelease"
}
"LTSC2021"
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 10 LTSC v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 10 LTSC 2021 v$LatestRelease"
} }
"Windows_10_PowerShell_5.1" "Windows_10_PowerShell_5.1"
{ {

Loading…
Cancel
Save