|
|
@ -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" |
|
|
@ -71,21 +70,19 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) |
|
|
|
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" |
|
|
@ -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" |
|
|
@ -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" |
|
|
|
{ |
|
|
|