|
|
@ -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" |
|
|
@ -53,17 +54,15 @@ 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" |
|
|
@ -76,16 +75,14 @@ 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 |
|
|
|
} |
|
|
|
} |
|
|
|
"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" |
|
|
@ -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" |
|
|
@ -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" |
|
|
@ -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" |
|
|
|