mirror of
https://github.com/pbatard/Fido.git
synced 2025-09-16 22:28:02 +02:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
29d8150b04 | ||
![]() |
f55fd2932c | ||
![]() |
06a14ba11c | ||
![]() |
4e6f25f351 | ||
![]() |
d43d7aeee3 | ||
![]() |
d8b2d24242 | ||
![]() |
903cae2f00 | ||
![]() |
5d4a4d7d14 | ||
![]() |
4a694421af | ||
![]() |
15a1a5923d | ||
![]() |
85a29fa2ae | ||
![]() |
a99f8a10d3 | ||
![]() |
146eec8673 | ||
![]() |
e9a0a367d9 | ||
![]() |
0b0643abc8 | ||
![]() |
1d88deac7c | ||
![]() |
9025d258e8 |
420
Fido.ps1
420
Fido.ps1
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Fido v1.44 - Feature ISO Downloader, for retail Windows images and UEFI Shell
|
||||
# Copyright © 2019-2023 Pete Batard <pete@akeo.ie>
|
||||
# Fido v1.58 - Feature ISO Downloader, for retail Windows images and UEFI Shell
|
||||
# Copyright © 2019-2024 Pete Batard <pete@akeo.ie>
|
||||
# Command line support: Copyright © 2021 flx5
|
||||
# ConvertTo-ImageSource: Copyright © 2016 Chris Carter
|
||||
#
|
||||
@@ -27,6 +27,8 @@ param(
|
||||
[string]$AppTitle = "Fido - Feature ISO Downloader",
|
||||
# (Optional) '|' separated UI localization strings.
|
||||
[string]$LocData,
|
||||
# (Optional) Forced locale
|
||||
[string]$Locale = "en-US",
|
||||
# (Optional) Path to a file that should be used for the UI icon.
|
||||
[string]$Icon,
|
||||
# (Optional) Name of a pipe the download URL should be sent to.
|
||||
@@ -43,9 +45,9 @@ param(
|
||||
# (Optional) Specify Windows architecture [Toggles commandline mode]
|
||||
[string]$Arch,
|
||||
# (Optional) Only display the download URL [Toggles commandline mode]
|
||||
[switch]$GetUrl = $False,
|
||||
[switch]$GetUrl = $false,
|
||||
# (Optional) Increase verbosity
|
||||
[switch]$Verbose = $False
|
||||
[switch]$Verbose = $false
|
||||
)
|
||||
#endregion
|
||||
|
||||
@@ -53,9 +55,9 @@ try {
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
} catch {}
|
||||
|
||||
$Cmd = $False
|
||||
$Cmd = $false
|
||||
if ($Win -or $Rel -or $Ed -or $Lang -or $Arch -or $GetUrl) {
|
||||
$Cmd = $True
|
||||
$Cmd = $true
|
||||
}
|
||||
|
||||
# Return a decimal Windows version that we can then check for platform support.
|
||||
@@ -81,36 +83,51 @@ if ($winver -lt 10.0) {
|
||||
}
|
||||
|
||||
#region Assembly Types
|
||||
$code = @"
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)]
|
||||
internal static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons);
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindow(IntPtr handle, int state);
|
||||
$Drawing_Assembly = "System.Drawing"
|
||||
# PowerShell 7 altered the name of the Drawing assembly...
|
||||
if ($host.version -ge "7.0") {
|
||||
$Drawing_Assembly += ".Common"
|
||||
}
|
||||
|
||||
// Extract an icon from a DLL
|
||||
public static Icon ExtractIcon(string file, int number, bool largeIcon)
|
||||
{
|
||||
IntPtr large, small;
|
||||
ExtractIconEx(file, number, out large, out small, 1);
|
||||
try {
|
||||
return Icon.FromHandle(largeIcon ? large : small);
|
||||
} catch {
|
||||
return null;
|
||||
$Signature = @{
|
||||
Namespace = "WinAPI"
|
||||
Name = "Utils"
|
||||
Language = "CSharp"
|
||||
UsingNamespace = "System.Runtime", "System.IO", "System.Text", "System.Drawing", "System.Globalization"
|
||||
ReferencedAssemblies = $Drawing_Assembly
|
||||
ErrorAction = "Stop"
|
||||
WarningAction = "Ignore"
|
||||
IgnoreWarnings = $true
|
||||
MemberDefinition = @"
|
||||
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)]
|
||||
internal static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindow(IntPtr handle, int state);
|
||||
// Extract an icon from a DLL
|
||||
public static Icon ExtractIcon(string file, int number, bool largeIcon) {
|
||||
IntPtr large, small;
|
||||
ExtractIconEx(file, number, out large, out small, 1);
|
||||
try {
|
||||
return Icon.FromHandle(largeIcon ? large : small);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
"@
|
||||
}
|
||||
|
||||
if (!$Cmd) {
|
||||
Write-Host Please Wait...
|
||||
$Drawing_Assembly = "System.Drawing"
|
||||
# PowerShell 7 altered the name of the Drawing assembly...
|
||||
if ($host.version -ge "7.0") {
|
||||
$Drawing_Assembly += ".Common"
|
||||
|
||||
if (!("WinAPI.Utils" -as [type]))
|
||||
{
|
||||
Add-Type @Signature
|
||||
}
|
||||
Add-Type -ErrorAction Stop -WarningAction Ignore -IgnoreWarnings -MemberDefinition $code -Namespace Gui -UsingNamespace System.Runtime, System.IO, System.Text, System.Drawing, System.Globalization -ReferencedAssemblies $Drawing_Assembly -Name Utils
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
|
||||
# Hide the powershell window: https://stackoverflow.com/a/27992426/1069307
|
||||
[Gui.Utils]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0) | Out-Null
|
||||
[WinAPI.Utils]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0) | Out-Null
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -121,191 +138,36 @@ $WindowsVersions = @(
|
||||
@(
|
||||
@("Windows 11", "windows11"),
|
||||
@(
|
||||
"22H2 v1 (Build 22621.525 - 2022.10)",
|
||||
@("Windows 11 Home/Pro/Edu", 2370),
|
||||
@("Windows 11 Home China ", ($zh + 2371))
|
||||
),
|
||||
@(
|
||||
"21H2 v1 (Build 22000.318 - 2021.11)",
|
||||
@("Windows 11 Home/Pro/Edu", 2093),
|
||||
@("Windows 11 Home China ", ($zh + 2094))
|
||||
),
|
||||
@(
|
||||
"21H2 (Build 22000.194 - 2021.10)",
|
||||
@("Windows 11 Home/Pro/Edu", 2069),
|
||||
@("Windows 11 Home China ", ($zh + 2070))
|
||||
"23H2 v2 (Build 22631.2861 - 2023.12)",
|
||||
@("Windows 11 Home/Pro/Edu", 2935),
|
||||
@("Windows 11 Home China ", ($zh + 2936))
|
||||
)
|
||||
),
|
||||
@(
|
||||
@("Windows 10", "Windows10ISO"),
|
||||
@(
|
||||
"22H2 (Build 19045.2006 - 2022.10)",
|
||||
@("Windows 10 Home/Pro/Edu", 2377),
|
||||
"22H2 v1 (Build 19045.2965 - 2023.05)",
|
||||
@("Windows 10 Home/Pro/Edu", 2618),
|
||||
@("Windows 10 Home China ", ($zh + 2378))
|
||||
),
|
||||
@(
|
||||
"21H2 (Build 19044.1288 - 2021.11)",
|
||||
@("Windows 10 Home/Pro/Edu", 2084),
|
||||
@("Windows 10 Home China ", ($zh + 2085))
|
||||
),
|
||||
@(
|
||||
"21H1 (Build 19043.985 - 2021.05)",
|
||||
@("Windows 10 Home/Pro", 2033),
|
||||
@("Windows 10 Education", 2032),
|
||||
@("Windows 10 Home China ", ($zh + 2034))
|
||||
),
|
||||
@(
|
||||
"20H2 (Build 19042.631 - 2020.12)",
|
||||
@("Windows 10 Home/Pro", 1882),
|
||||
@("Windows 10 Education", 1884),
|
||||
@("Windows 10 Home China ", ($zh + 1883))
|
||||
),
|
||||
@(
|
||||
"20H2 (Build 19042.508 - 2020.10)",
|
||||
@("Windows 10 Home/Pro", 1807),
|
||||
@("Windows 10 Education", 1805),
|
||||
@("Windows 10 Home China ", ($zh + 1806))
|
||||
),
|
||||
@(
|
||||
"20H1 (Build 19041.264 - 2020.05)",
|
||||
@("Windows 10 Home/Pro", 1626),
|
||||
@("Windows 10 Education", 1625),
|
||||
@("Windows 10 Home China ", ($zh + 1627))
|
||||
),
|
||||
@(
|
||||
"19H2 (Build 18363.418 - 2019.11)",
|
||||
@("Windows 10 Home/Pro", 1429),
|
||||
@("Windows 10 Education", 1431),
|
||||
@("Windows 10 Home China ", ($zh + 1430))
|
||||
),
|
||||
@(
|
||||
"19H1 (Build 18362.356 - 2019.09)",
|
||||
@("Windows 10 Home/Pro", 1384),
|
||||
@("Windows 10 Education", 1386),
|
||||
@("Windows 10 Home China ", ($zh + 1385))
|
||||
),
|
||||
@(
|
||||
"19H1 (Build 18362.30 - 2019.05)",
|
||||
@("Windows 10 Home/Pro", 1214),
|
||||
@("Windows 10 Education", 1216),
|
||||
@("Windows 10 Home China ", ($zh + 1215))
|
||||
),
|
||||
@(
|
||||
"1809 R3 (Build 17763.379 - 2019.03)",
|
||||
@("Windows 10 Home/Pro", 1203),
|
||||
@("Windows 10 Education", 1202),
|
||||
@("Windows 10 Home China ", ($zh + 1204))
|
||||
),
|
||||
@(
|
||||
"1809 R2 (Build 17763.107 - 2018.10)",
|
||||
@("Windows 10 Home/Pro", 1060),
|
||||
@("Windows 10 Education", 1056),
|
||||
@("Windows 10 Home China ", ($zh + 1061))
|
||||
),
|
||||
@(
|
||||
"1809 R1 (Build 17763.1 - 2018.09)",
|
||||
@("Windows 10 Home/Pro", 1019),
|
||||
@("Windows 10 Education", 1021),
|
||||
@("Windows 10 Home China ", ($zh + 1020))
|
||||
),
|
||||
@(
|
||||
"1803 (Build 17134.1 - 2018.04)",
|
||||
@("Windows 10 Home/Pro", 651),
|
||||
@("Windows 10 Education", 655),
|
||||
@("Windows 10 1803", 637),
|
||||
@("Windows 10 Home China", ($zh + 652))
|
||||
),
|
||||
@(
|
||||
"1709 (Build 16299.15 - 2017.09)",
|
||||
@("Windows 10 Home/Pro", 484),
|
||||
@("Windows 10 Education", 488),
|
||||
@("Windows 10 Home China", ($zh + 485))
|
||||
),
|
||||
@(
|
||||
"1703 [Redstone 2] (Build 15063.0 - 2017.03)",
|
||||
@("Windows 10 Home/Pro", 361),
|
||||
@("Windows 10 Home/Pro N", 362),
|
||||
@("Windows 10 Single Language", 363),
|
||||
@("Windows 10 Education", 423),
|
||||
@("Windows 10 Education N", 424),
|
||||
@("Windows 10 Home China", ($zh + 364))
|
||||
),
|
||||
@(
|
||||
"1607 [Redstone 1] (Build 14393.0 - 2016.07)",
|
||||
@("Windows 10 Home/Pro", 244),
|
||||
@("Windows 10 Home/Pro N", 245),
|
||||
@("Windows 10 Single Language", 246),
|
||||
@("Windows 10 Education", 242),
|
||||
@("Windows 10 Education N", 243),
|
||||
@("Windows 10 China Get Genuine", ($zh + 247))
|
||||
),
|
||||
@(
|
||||
"1511 R3 [Threshold 2] (Build 10586.164 - 2016.04)",
|
||||
@("Windows 10 Home/Pro", 178),
|
||||
@("Windows 10 Home/Pro N", 183),
|
||||
@("Windows 10 Single Language", 184),
|
||||
@("Windows 10 Education", 179),
|
||||
@("Windows 10 Education N", 181),
|
||||
@("Windows 10 KN", ($ko + 182)),
|
||||
@("Windows 10 Education KN", ($ko + 180)),
|
||||
@("Windows 10 China Get Genuine", ($zh + 185))
|
||||
),
|
||||
@(
|
||||
"1511 R2 [Threshold 2] (Build 10586.104 - 2016.02)",
|
||||
@("Windows 10 Home/Pro", 109),
|
||||
@("Windows 10 Home/Pro N", 115),
|
||||
@("Windows 10 Single Language", 116),
|
||||
@("Windows 10 Education", 110),
|
||||
@("Windows 10 Education N", 112),
|
||||
@("Windows 10 KN", ($ko + 114)),
|
||||
@("Windows 10 Education KN", ($ko + 111)),
|
||||
@("Windows 10 China Get Genuine", ($zh + 113))
|
||||
),
|
||||
@(
|
||||
"1511 R1 [Threshold 2] (Build 10586.0 - 2015.11)",
|
||||
@("Windows 10 Home/Pro", 99),
|
||||
@("Windows 10 Home/Pro N", 105),
|
||||
@("Windows 10 Single Language", 106),
|
||||
@("Windows 10 Education", 100),
|
||||
@("Windows 10 Education N", 102),
|
||||
@("Windows 10 KN", ($ko + 104)),
|
||||
@("Windows 10 Education KN", ($ko + 101)),
|
||||
@("Windows 10 China Get Genuine", ($zh + 103))
|
||||
),
|
||||
@(
|
||||
"1507 [Threshold 1] (Build 10240.16384 - 2015.07)",
|
||||
@("Windows 10 Home/Pro", 79),
|
||||
@("Windows 10 Home/Pro N", 81),
|
||||
@("Windows 10 Single Language", 82),
|
||||
@("Windows 10 Education", 75)
|
||||
@("Windows 10 Education N", 77),
|
||||
@("Windows 10 KN", ($ko + 80)),
|
||||
@("Windows 10 Education KN", ($ko + 76)),
|
||||
@("Windows 10 China Get Genuine", ($zh + 78))
|
||||
)
|
||||
),
|
||||
@(
|
||||
@("Windows 8.1", "windows8ISO"),
|
||||
@(
|
||||
"Update 3 (build 9600)",
|
||||
@("Windows 8.1 Standard", 52),
|
||||
@("Windows 8.1 N", 55)
|
||||
@("Windows 8.1 Single Language", 48),
|
||||
@("Windows 8.1 K", ($ko + 61)),
|
||||
@("Windows 8.1 KN", ($ko + 62))
|
||||
)
|
||||
),
|
||||
@(
|
||||
@("Windows 7", "WIN7"),
|
||||
@(
|
||||
"with SP1 (build 7601)",
|
||||
@("Windows 7 Ultimate", 0),
|
||||
@("Windows 7 Professional", 1),
|
||||
@("Windows 7 Home Premium", 2)
|
||||
)
|
||||
),
|
||||
)
|
||||
@(
|
||||
@("UEFI Shell 2.2", "UEFI_SHELL 2.2"),
|
||||
@(
|
||||
"24H1 (edk2-stable202405)",
|
||||
@("Release", 0),
|
||||
@("Debug", 1)
|
||||
),
|
||||
@(
|
||||
"23H2 (edk2-stable202311)",
|
||||
@("Release", 0),
|
||||
@("Debug", 1)
|
||||
),
|
||||
@(
|
||||
"23H1 (edk2-stable202305)",
|
||||
@("Release", 0),
|
||||
@("Debug", 1)
|
||||
),
|
||||
@(
|
||||
"22H2 (edk2-stable202211)",
|
||||
@("Release", 0),
|
||||
@@ -340,42 +202,6 @@ $WindowsVersions = @(
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
$Windows7Versions = @(
|
||||
# 0: Windows 7 Ultimate
|
||||
@(
|
||||
# Need a dummy to prevent PS from coalescing single array entries
|
||||
@(""),
|
||||
@("English (US)", "en-us",
|
||||
@(
|
||||
@("x64", "https://download.microsoft.com/download/5/1/9/5195A765-3A41-4A72-87D8-200D897CBE21/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_ULTIMATE_x64FRE_en-us.iso"),
|
||||
@("x86", "https://download.microsoft.com/download/1/E/6/1E6B4803-DD2A-49DF-8468-69C0E6E36218/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_ULTIMATE_x86FRE_en-us.iso")
|
||||
)
|
||||
)
|
||||
),
|
||||
# 1: Windows 7 Profesional
|
||||
@(
|
||||
@(""),
|
||||
@("English (US)", "en-us",
|
||||
@(
|
||||
@("x64", "https://download.microsoft.com/download/0/6/3/06365375-C346-4D65-87C7-EE41F55F736B/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_PROFESSIONAL_x64FRE_en-us.iso"),
|
||||
@("x86", "https://download.microsoft.com/download/C/0/6/C067D0CD-3785-4727-898E-60DC3120BB14/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_PROFESSIONAL_x86FRE_en-us.iso")
|
||||
)
|
||||
)
|
||||
),
|
||||
# 2: Windows 7 Home Premium
|
||||
@(
|
||||
@(""),
|
||||
@("English (US)", "en-us",
|
||||
@(
|
||||
@("x64", "https://download.microsoft.com/download/E/A/8/EA804D86-C3DF-4719-9966-6A66C9306598/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_HOMEPREMIUM_x64FRE_en-us.iso"),
|
||||
@("x86", "https://download.microsoft.com/download/E/D/A/EDA6B508-7663-4E30-86F9-949932F443D0/7601.24214.180801-1700.win7sp1_ldr_escrow_CLIENT_HOMEPREMIUM_x86FRE_en-us.iso")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
@@ -425,9 +251,9 @@ function Select-Language([string]$LangName)
|
||||
($SysLocale.StartsWith("tr") -and $LangName -like "*Turk*") -or `
|
||||
($SysLocale.StartsWith("uk") -and $LangName -like "*Ukrain*") -or `
|
||||
($SysLocale.StartsWith("vi") -and $LangName -like "*Vietnam*")) {
|
||||
return $True
|
||||
return $true
|
||||
}
|
||||
return $False
|
||||
return $false
|
||||
}
|
||||
|
||||
function Add-Entry([int]$pos, [string]$Name, [array]$Items, [string]$DisplayName)
|
||||
@@ -520,7 +346,7 @@ function ConvertTo-ImageSource
|
||||
function Throw-Error([object]$Req, [string]$Alt)
|
||||
{
|
||||
$Err = $(GetElementById -Request $Req -Id "errorModalMessage").innerText -replace "<[^>]+>" -replace "\s+", " "
|
||||
if (-not $Err) {
|
||||
if (!$Err) {
|
||||
$Err = $Alt
|
||||
} else {
|
||||
$Err = [System.Text.Encoding]::UTF8.GetString([byte[]][char[]]$Err)
|
||||
@@ -531,7 +357,7 @@ function Throw-Error([object]$Req, [string]$Alt)
|
||||
# Translate a message string
|
||||
function Get-Translation([string]$Text)
|
||||
{
|
||||
if (-not $English -contains $Text) {
|
||||
if (!($English -contains $Text)) {
|
||||
Write-Host "Error: '$Text' is not a translatable string"
|
||||
return "(Untranslated)"
|
||||
}
|
||||
@@ -569,7 +395,7 @@ function Error([string]$ErrorMessage)
|
||||
if (!$Cmd) {
|
||||
$XMLForm.Title = $(Get-Translation("Error")) + ": " + $ErrorMessage
|
||||
Refresh-Control($XMLForm)
|
||||
$XMLGrid.Children[2 * $script:Stage + 1].IsEnabled = $True
|
||||
$XMLGrid.Children[2 * $script:Stage + 1].IsEnabled = $true
|
||||
$UserInput = [System.Windows.MessageBox]::Show($XMLForm.Title, $(Get-Translation("Error")), "OK", "Error")
|
||||
$script:ExitCode = $script:Stage--
|
||||
} else {
|
||||
@@ -605,6 +431,7 @@ function Get-RandomDate()
|
||||
|
||||
#region Globals
|
||||
$ErrorActionPreference = "Stop"
|
||||
$DefaultTimeout = 30
|
||||
$dh = 58
|
||||
$Stage = 0
|
||||
$SelectedIndex = 0
|
||||
@@ -615,7 +442,7 @@ if ($Cmd) {
|
||||
$MaxStage = 4
|
||||
$SessionId = [guid]::NewGuid()
|
||||
$ExitCode = 100
|
||||
$Locale = "en-US"
|
||||
$Locale = $Locale
|
||||
$RequestData = @{}
|
||||
# This GUID applies to all visitors, regardless of their locale
|
||||
$RequestData["GetLangs"] = @("a8f8f489-4c7f-463a-9ca6-5cff94d8d041", "getskuinformationbyproductedition" )
|
||||
@@ -642,7 +469,7 @@ $EnglishMessages = "en-US|Version|Release|Edition|Language|Architecture|Download
|
||||
"This feature is not available on this platform."
|
||||
[string[]]$English = $EnglishMessages.Split('|')
|
||||
[string[]]$Localized = $null
|
||||
if ($LocData -and (-not $LocData.StartsWith("en-US"))) {
|
||||
if ($LocData -and !$LocData.StartsWith("en-US")) {
|
||||
$Localized = $LocData.Split('|')
|
||||
# Adjust the $Localized array if we have more or fewer strings than in $EnglishMessages
|
||||
if ($Localized.Length -lt $English.Length) {
|
||||
@@ -676,8 +503,18 @@ function Check-Locale
|
||||
if ($Verbosity -ge 2) {
|
||||
Write-Host Querying $url
|
||||
}
|
||||
Invoke-WebRequest -UseBasicParsing -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
|
||||
# Looks Microsoft are filtering our script according to the first query it performs with the spoofed user agent.
|
||||
# So, to continue this pointless cat and mouse game, we simply add an extra first query with the default user agent.
|
||||
# Also: "Hi Microsoft. You sure have A LOT OF RESOURCES TO WASTE to have assigned folks of yours to cripple scripts
|
||||
# that merely exist because you have chosen to make the user experience from your download website utterly subpar.
|
||||
# And while I am glad senpai noticed me (UwU), I feel compelled to ask: Don't you guys have better things to do?"
|
||||
Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 $url | Out-Null
|
||||
Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
|
||||
} catch {
|
||||
# Of course PowerShell 7 had to BREAK $_.Exception.Status on timeouts...
|
||||
if ($_.Exception.Status -eq "Timeout" -or $_.Exception.GetType().Name -eq "TaskCanceledException") {
|
||||
Write-Host Operation Timed out
|
||||
}
|
||||
$script:QueryLocale = "en-US"
|
||||
}
|
||||
}
|
||||
@@ -732,7 +569,7 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
|
||||
Write-Host Querying $url
|
||||
}
|
||||
try {
|
||||
Invoke-WebRequest -UseBasicParsing -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
|
||||
Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
|
||||
} catch {
|
||||
Error($_.Exception.Message)
|
||||
return @()
|
||||
@@ -751,7 +588,7 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
|
||||
|
||||
$script:SelectedIndex = 0
|
||||
try {
|
||||
$r = Invoke-WebRequest -Method Post -UseBasicParsing -UserAgent $UserAgent -SessionVariable "Session" $url
|
||||
$r = Invoke-WebRequest -Method Post -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -SessionVariable "Session" $url
|
||||
if ($r -match "errorModalMessage") {
|
||||
Throw-Error -Req $r -Alt "Could not retrieve languages from server"
|
||||
}
|
||||
@@ -841,12 +678,13 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
|
||||
$Is64 = [Environment]::Is64BitOperatingSystem
|
||||
# Must add a referer for this request, else Microsoft's servers will deny it
|
||||
$ref = "https://www.microsoft.com/software-download/windows11"
|
||||
$r = Invoke-WebRequest -Method Post -Headers @{ "Referer" = $ref } -UseBasicParsing -UserAgent $UserAgent -WebSession $Session $url
|
||||
$r = Invoke-WebRequest -Method Post -Headers @{ "Referer" = $ref } -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -WebSession $Session $url
|
||||
if ($r -match "errorModalMessage") {
|
||||
$Alt = [regex]::Match($r, '<p id="errorModalMessage">(.+?)<\/p>').Groups[1].Value -replace "<[^>]+>" -replace "\s+", " " -replace "\?\?\?", "-"
|
||||
if (-not $Alt) {
|
||||
$Alt = [regex]::Match($r.Content, '<p id="errorModalMessage">(.+?)<\/p>').Groups[1].Value -replace "<[^>]+>" -replace "\s+", " " -replace "\?\?\?", "-"
|
||||
$Alt = [System.Text.Encoding]::UTF8.GetString([byte[]][char[]]$Alt)
|
||||
if (!$Alt) {
|
||||
$Alt = "Could not retrieve architectures from server"
|
||||
} else {
|
||||
} elseif ($Alt -match "715-123130") {
|
||||
$Alt += " " + $SessionId + "."
|
||||
}
|
||||
Throw-Error -Req $r -Alt $Alt
|
||||
@@ -864,7 +702,7 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
|
||||
foreach ($var in $xml.inputs.input) {
|
||||
$json = $var.value | ConvertFrom-Json;
|
||||
if ($json) {
|
||||
if (($Is64 -and $json.DownloadType -eq "x64") -or (-not $Is64 -and $json.DownloadType -eq "x86")) {
|
||||
if (($Is64 -and $json.DownloadType -eq "x64") -or (!$Is64 -and $json.DownloadType -eq "x86")) {
|
||||
$script:SelectedIndex = $i
|
||||
}
|
||||
$links += @(New-Object PsObject -Property @{ Type = $json.DownloadType; Link = $json.Uri })
|
||||
@@ -886,14 +724,14 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
|
||||
function Process-Download-Link([string]$Url)
|
||||
{
|
||||
try {
|
||||
if ($PipeName -and -not $Check.IsChecked) {
|
||||
if ($PipeName -and !$Check.IsChecked) {
|
||||
Send-Message -PipeName $PipeName -Message $Url
|
||||
} else {
|
||||
if ($Cmd) {
|
||||
$pattern = '.*\/(.*\.iso).*'
|
||||
$File = [regex]::Match($Url, $pattern).Groups[1].Value
|
||||
# PowerShell implicit conversions are iffy, so we need to force them...
|
||||
$str_size = (Invoke-WebRequest -UseBasicParsing -Uri $Url -Method Head).Headers.'Content-Length'
|
||||
$str_size = (Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -Uri $Url -Method Head).Headers.'Content-Length'
|
||||
$tmp_size = [uint64]::Parse($str_size)
|
||||
$Size = Size-To-Human-Readable $tmp_size
|
||||
Write-Host "Downloading '$File' ($Size)..."
|
||||
@@ -1082,7 +920,7 @@ $XMLForm.Title = $AppTitle
|
||||
if ($Icon) {
|
||||
$XMLForm.Icon = $Icon
|
||||
} else {
|
||||
$XMLForm.Icon = [Gui.Utils]::ExtractIcon("imageres.dll", -5205, $true) | ConvertTo-ImageSource
|
||||
$XMLForm.Icon = [WinAPI.Utils]::ExtractIcon("imageres.dll", -5205, $true) | ConvertTo-ImageSource
|
||||
}
|
||||
if ($Locale.StartsWith("ar") -or $Locale.StartsWith("fa") -or $Locale.StartsWith("he")) {
|
||||
$XMLForm.FlowDirection = "RightToLeft"
|
||||
@@ -1110,9 +948,9 @@ $WindowsVersion.DisplayMemberPath = "Version"
|
||||
# Button Action
|
||||
$Continue.add_click({
|
||||
$script:Stage++
|
||||
$XMLGrid.Children[2 * $Stage + 1].IsEnabled = $False
|
||||
$Continue.IsEnabled = $False
|
||||
$Back.IsEnabled = $False
|
||||
$XMLGrid.Children[2 * $Stage + 1].IsEnabled = $false
|
||||
$Continue.IsEnabled = $false
|
||||
$Back.IsEnabled = $false
|
||||
Refresh-Control($Continue)
|
||||
Refresh-Control($Back)
|
||||
|
||||
@@ -1121,7 +959,7 @@ $Continue.add_click({
|
||||
1 { # Windows Version selection
|
||||
$XMLForm.Title = Get-Translation($English[12])
|
||||
Refresh-Control($XMLForm)
|
||||
if ($WindowsVersion.SelectedValue.Version.StartsWith("Windows") -and $WindowsVersion.SelectedValue.Version -ne "Windows 7") {
|
||||
if ($WindowsVersion.SelectedValue.Version.StartsWith("Windows")) {
|
||||
Check-Locale
|
||||
}
|
||||
$releases = Get-Windows-Releases $WindowsVersion.SelectedValue.Index
|
||||
@@ -1180,9 +1018,9 @@ $Continue.add_click({
|
||||
$XMLForm.Close()
|
||||
}
|
||||
}
|
||||
$Continue.IsEnabled = $True
|
||||
$Continue.IsEnabled = $true
|
||||
if ($Stage -ge 0) {
|
||||
$Back.IsEnabled = $True
|
||||
$Back.IsEnabled = $true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1192,7 +1030,7 @@ $Back.add_click({
|
||||
} else {
|
||||
$XMLGrid.Children.RemoveAt(2 * $Stage + 3)
|
||||
$XMLGrid.Children.RemoveAt(2 * $Stage + 2)
|
||||
$XMLGrid.Children[2 * $Stage + 1].IsEnabled = $True
|
||||
$XMLGrid.Children[2 * $Stage + 1].IsEnabled = $true
|
||||
$dh2 = $dh
|
||||
if ($Stage -eq 4 -and $PipeName) {
|
||||
$Check.Visibility = "Collapsed"
|
||||
@@ -1217,7 +1055,7 @@ $Back.add_click({
|
||||
})
|
||||
|
||||
# Display the dialog
|
||||
$XMLForm.Add_Loaded( { $XMLForm.Activate() } )
|
||||
$XMLForm.Add_Loaded({$XMLForm.Activate()})
|
||||
$XMLForm.ShowDialog() | Out-Null
|
||||
|
||||
# Clean up & exit
|
||||
@@ -1226,8 +1064,8 @@ exit $ExitCode
|
||||
# SIG # Begin signature block
|
||||
# MIIkWQYJKoZIhvcNAQcCoIIkSjCCJEYCAQExDzANBglghkgBZQMEAgEFADB5Bgor
|
||||
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
|
||||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDCpZpntjuU2uHY
|
||||
# z3/0OsY2UtUKjz1UjCN6T8dRzpny96CCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU
|
||||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAo88a5qfFR5eNa
|
||||
# dlaOq6jGKATitcy/nhPuLUO1tQvOwaCCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU
|
||||
# jTanyYqJ1p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|
||||
# 1uFPptTjB6god6UJb18em84DS11lFVfc1R5nTqmNdJ4PQLM3U0wqjR4vfQkCW+0u
|
||||
# diqsdHIkLXzvzK8uPU4IgfN14O20gxwB7L1n8roe/ibil8elFUwHICC44ddHGYsd
|
||||
# SN66NREeU82z+4vis38lWzIajhuGNaXa/kSDB31yL431CgPtW+RxMj4D/DvM
|
||||
# SIG # End signature block
|
||||
|
18
README.md
18
README.md
@@ -56,12 +56,7 @@ the actual download links, for all the architectures available for that language
|
||||
Requirements
|
||||
------------
|
||||
|
||||
PowerShell 3.0 or later is required. However the script should detect if you are using an older version and point you to
|
||||
the relevant PowerShell 3.0 download page if needed (which should only ever occur if you are running a vanilla version
|
||||
of Windows 7).
|
||||
|
||||
Note that the current version of the script does not need Internet Explorer to be installed and should also work with
|
||||
PowerShell 7.
|
||||
Windows 8 or later with PowerShell. Windows 7 is __not__ supported.
|
||||
|
||||
Commandline mode
|
||||
----------------
|
||||
@@ -69,19 +64,22 @@ Commandline mode
|
||||
Fido supports commandline mode whereas, whenever one of the following options is provided, a GUI is not instantiated
|
||||
and you can instead generate the ISO download from within a PowerShell console or script.
|
||||
|
||||
Note however that, as of 2023.05, Microsoft has removed access to older releases of Windows ISOs and as a result, the
|
||||
list of releases that can be downloaded from Fido has had to be reduced to only the latest for each version.
|
||||
|
||||
The options are:
|
||||
- `Win`: Specify Windows version (e.g. _"Windows 10"_). Abbreviated version should work as well (e.g `-Win 10`) as long
|
||||
as it is unique enough. If this option isn't specified, the most recent version of Windows is automatically selected.
|
||||
as it is unique enough. If this option isn't specified, the most recent version of Windows is automatically selected.
|
||||
You can obtain a list of supported versions by specifying `-Win List`.
|
||||
- `Rel`: Specify Windows release (e.g. _"21H1"_). If this option isn't specified, the most recent release for the chosen
|
||||
version of Windows is automatically selected. You can also use `-Rel Latest` to force the most recent to be used.
|
||||
You can obtain a list of supported versions by specifying `-Rel List`.
|
||||
- `Ed`: Specify Windows edition (e.g. _"Pro/Home"_). Abbreviated editions should work as well (e.g `-Ed Pro`) as long
|
||||
as it is unique enough. If this option isn't specified, the most recent version of Windows is automatically selected.
|
||||
as it is unique enough. If this option isn't specified, the most recent version of Windows is automatically selected.
|
||||
You can obtain a list of supported versions by specifying `-Ed List`.
|
||||
- `Lang`: Specify Windows language (e.g. _"Arabic"_). Abbreviated or part of a language (e.g. `-Lang Int` for
|
||||
`English International`) should work as long as it's unique enough. If this option isn't specified, the script attempts
|
||||
to select the same language as the system locale.
|
||||
to select the same language as the system locale.
|
||||
You can obtain a list of supported languages by specifying `-Lang List`.
|
||||
- `Arch`: Specify Windows architecture (e.g. _"x64"_). If this option isn't specified, the script attempts to use the same
|
||||
architecture as the one from the current system.
|
||||
@@ -126,7 +124,7 @@ Additional Notes
|
||||
|
||||
Because of its intended usage with Rufus, this script is not designed to cover every possible retail ISO downloads.
|
||||
Instead we mostly chose the ones that the general public is likely to request. For instance, we currently have no plan
|
||||
to add support for LTSB/LTSC Windows 10 ISOs downloads.
|
||||
to add support for LTSB/LTSC Windows ISOs downloads.
|
||||
|
||||
If you are interested in such downloads, then you are kindly invited to visit the relevant download pages from Microsoft
|
||||
such as [this one](https://www.microsoft.com/evalcenter/evaluate-windows-10-enterprise) for LTSC versions.
|
||||
|
Reference in New Issue
Block a user