Skip to content

Commit

Permalink
Update Download_Sophia.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 authored Apr 2, 2024
1 parent 4fd350c commit 84f36a0
Showing 1 changed file with 16 additions and 31 deletions.
47 changes: 16 additions & 31 deletions Download_Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ $LatestGitHubRelease = (Invoke-RestMethod @Parameters).tag_name

$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"

$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
UseBasicParsing = $true
}

switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
{
"17763"
{
# Check if Windows 10 is an LTSC 2019
# Check if Windows 10 is LTSC 2019
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -match "LTSC 2019")
{
$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_LTSC2019
$Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
Expand All @@ -53,39 +54,35 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
else
{
Write-Verbose -Message "Windows version is not supported. Update your Windows" -Verbose
Start-Process -FilePath "ms-settings:windowsupdate"
exit
}
}
"19044"
{
# Check if Windows 10 is an LTSC 2021
# Check if Windows 10 is LTSC 2021
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -match "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"
$Version = "LTSC2021"
}
else
{
Write-Verbose -Message "Windows version is not supported. Update your Windows" -Verbose
Start-Process -FilePath "ms-settings:windowsupdate"
exit
}
}
"19045"
{
if ($Host.Version.Major -eq 5)
{
$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_PowerShell_5_1
$Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.v$LatestRelease.zip"
Expand All @@ -98,10 +95,6 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
}
else
{
$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_PowerShell_7
$Parameters = @{
Uri = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip"
Expand All @@ -113,14 +106,10 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
$Version = "Windows_10_PowerShell_7"
}
}
{$_ -ge 22000}
{$_ -ge 22631}
{
if ($Host.Version.Major -eq 5)
{
$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_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"
Expand All @@ -133,10 +122,6 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
}
else
{
$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_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"
Expand Down Expand Up @@ -172,17 +157,17 @@ switch ($Version)
"LTSC2021"
{
Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease"
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"
}
"Windows_10_PowerShell_5.1"
{
Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_v$LatestRelease"
Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_v$LatestRelease"
Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_v$LatestRelease"
}
"Windows_10_PowerShell_7"
{
Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease"
Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease"
Set-Location -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease"
}
"Windows_11_PowerShell_5.1"
{
Expand Down

0 comments on commit 84f36a0

Please sign in to comment.