Compare commits

..

34 Commits
v1.33 ... v1.58

Author SHA1 Message Date
Pete Batard
29d8150b04 Remove Windows 8.1 downloads
* Microsoft removed them from their website.
2024-07-08 12:34:10 +01:00
Pete Batard
f55fd2932c Switch back to using 'Invoke-WebRequest' instead of 'curl'
* Closes #91.
2024-06-18 12:08:48 +01:00
Pete Batard
06a14ba11c Add UEFI Shell 24H1 ISO downloads 2024-05-30 13:16:38 +01:00
Pete Batard
4e6f25f351 Work around the latest Microsoft server restrictions
* It looks like Microsoft are actively filtering our script by detecting our first request with the
  spoofed user-agent, so work around that.
* Also switch to using 'curl' instead of 'Invoke-WebRequest'. May break PowerShell 7.0, but I'm only
  concerned about Rufus usage for now.
* Also add timeouts on web requests.
* Closes #88.
2024-02-07 15:55:59 +00:00
Pete Batard
d43d7aeee3 Add Windows 11 23H2 v2 downloads
* With thanks to @ave9858.
* Closes #83.
2023-12-19 10:27:44 +00:00
Pete Batard
d8b2d24242 Add UEFI Shell 23H2 ISO downloads
* Also fix Windows 11 23H2 build version since Microsoft are *UTTERLY USELESS*
  at providing an accurate product version number in the .wim's XML versioning
  files they are in bloody charge of populating...
2023-11-25 17:55:01 +00:00
Pete Batard
903cae2f00 Add Windows 11 23H2 downloads
* Replaces Windows 11 22H2, since past history indicates that Microsoft is
  not going to keep the Windows 11 22H2 ISOs available for much longer.
* Note that Microsoft has *no* plans to ever release a Windows 10 23H2.
* Closes #76.
2023-10-31 19:23:43 +01:00
Pete Batard
5d4a4d7d14 Fix a regression with IgnoreWarnings
* Commit 1d88deac7c removed the IgnoreWarnings flag which was
  needed as a fix for pbatard/rufus#2030.
* Contributed by @Tom-EllisEVENTS.
* Closes pbatard/rufus#2315.
2023-09-08 18:35:53 +01:00
Pete Batard
4a694421af Add UEFI Shell 2.2 23H1 download 2023-06-06 13:49:50 +01:00
Pete Batard
15a1a5923d Add Windows 10 22H2 v1 downloads
* Closes #72
2023-05-25 00:07:45 +01:00
ChaseKnowlden
85a29fa2ae Add Windows 11 22H2 v2 downloads
* And remove Windows 11 22H2 v1 downloads since these have been disabled by Microsoft
* Closes #71
2023-05-24 00:31:37 +01:00
Pete Batard
a99f8a10d3 Remove releases that have been made inaccessible by Microsoft
* Closes #67
2023-05-23 17:26:18 +01:00
Pete Batard
146eec8673 Add -Locale option and fix encoding for error handling 2023-05-15 11:42:08 +01:00
Pete Batard
e9a0a367d9 Update README 2023-04-14 11:54:05 +01:00
Pete Batard
0b0643abc8 Remove Windows 7 downloads
* Since Microsoft removed the ISOs from their servers
* Closes #64
2023-04-14 11:42:34 +01:00
Dmitry Nefedov
1d88deac7c Improve code for P/Invoke
* Closes #62
2023-04-14 11:36:33 +01:00
Pete Batard
9025d258e8 Harmonise the use of $true/$false and not operator 2023-04-14 11:29:40 +01:00
Pete Batard
425eb4da24 Prevent Fido from running on non Windows platforms
* Per #58, we consider that letting non-Windows users run Fido is going to become
  too much of liability moving forward, so the script now detects non Windows
  platforms and actively prevent itself from running there.
* Closes #60.
* Also some whitespace cleanup.
2023-03-07 12:16:57 +00:00
Pete Batard
10acbf9f84 Improve error handling
* Simplify regex and fix unconverted characters.
* Also use Start-BitsTransfer for cmdline downloads (Closes #56).
* Also remove -DisableProgress now that we use Start-BitsTransfer.
2023-02-06 01:22:02 +00:00
Pete Batard
4b24ae5795 Fix Windows 7 detection
* Of course, Windows 7's PowerShell is too stupid to actually compare Version objects.
2023-01-27 15:12:02 +00:00
Pete Batard
2ca0f62f53 Fix language regexp and force TLS for Windows 8.x
* Non En locales may still return '<select id="product-languages">' instead of
  '<select id="product-languages" ...>' so make sure we account for that case.
* Addresses pbatard/rufus#2148
* Also force TLS for Windows 8.x to address pbatard/rufus#2133
2023-01-27 13:39:13 +00:00
Pete Batard
448cfa72cf Remove Windows 7 support
* "I'm sorry for your loss. Move on."
2023-01-27 13:28:28 +00:00
Pete Batard
9552df66d5 Update language option regexp to match latest Microsoft HTML fragment
* Addresses pbatard/rufus#2146
* Also update .gitattributes to clean up release archives
2023-01-25 20:04:14 +00:00
Pete Batard
4bafb688da Remove unneeded files
* .whitesource is unneeded because we don't use external dependencies.
* VS project files are unneeded when we just edit the .ps1 in a text editor.
2023-01-11 20:22:13 +00:00
Pete Batard
ad79094c30 Improve error handling and reporting when querying vlscppe.microsoft.com
* Also use a better default icon and add a preemptive localized message for
  future countermeasures from Microsoft.
2023-01-09 17:32:59 +00:00
Pete Batard
8cf4a279ff Work around Microsoft's new ISO download countermeasures
* The Microsoft servers now use session Id whitelisting, so add querying
  of https://vlscppe.microsoft.com/tags with the session Id.
* Closes #52.
* Also harmonize/improve -replace calls
* Also make sure we use POST for the getskuinformationbyproductedition
  query (in case Microsoft add some more countermeasures).
* Also drop 'cmd /c' invocation in sign.sh since the cygwin people can't
  seem to get their act together there...
2023-01-08 22:10:01 +00:00
Pete Batard
84f833b067 Improve error reporting
* Now return the error message from the Microsoft server where possible (See #52)
2023-01-06 21:58:20 +00:00
Pete Batard
c34a41fe3f Add UEFI Shell 2.2 22H2 download 2022-12-15 00:20:19 +00:00
Erik Dansbo
6593585ff3 Add an option to disable progress report for commandline
* Closes #50
2022-12-14 17:11:09 +00:00
Pete Batard
fac4c49262 Add Windows 10 22H2 builds
* And remove Windows 11 22H2 *v0* builds since Microsoft removed the ISOs from their servers
2022-10-19 13:48:03 +01:00
Pete Batard
f8aacf0703 Add Windows 11 22H2 v1 builds
* "How many Microsoft engineers does it take to release the ISO of a light bulb?"
* This addresses #45 by restoring a working Windows 11 22H2 download, though it
  remains to be seen if the ISO for 22H2 v0 will be accessible ever again...
2022-10-01 13:59:42 +01:00
Pete Batard
24a7a04d78 Update README 2022-09-23 17:36:21 +01:00
Pete Batard
eefc2453c4 Fix handling of parentheses for -Lang option
* Closes #29
2022-09-23 17:02:36 +01:00
Pete Batard
ed1a6b31a6 Fix Add-Type warnings being treated as errors on PS < 7.0
* Closes pbatard/rufus#2030
2022-09-23 16:47:44 +01:00
8 changed files with 237 additions and 411 deletions

View File

@@ -2,7 +2,8 @@
root = true
[*]
trim_trailing_whitespace = true
insert_final_newline = true
# Must use a BOM else Unicode strings will not display
charset = utf-8-bom
insert_final_newline = true
indent_style = tab
trim_trailing_whitespace = true

3
.gitattributes vendored
View File

@@ -1,3 +1,6 @@
* text=auto
*.ps1 eol=crlf
*.sh eol=lf
.gitattributes export-ignore
.gitignore export-ignore
sign.sh export-ignore

View File

@@ -1,8 +0,0 @@
{
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure"
},
"issueSettings": {
"minSeverityLevel": "LOW"
}
}

528
Fido.ps1
View File

@@ -1,6 +1,6 @@
#
# Fido v1.33 - Feature ISO Downloader, for retail Windows images and UEFI Shell
# Copyright © 2019-2022 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
#
@@ -24,9 +24,11 @@
#region Parameters
param(
# (Optional) The title to display on the application window.
[string]$AppTitle = "Fido - Retail Windows ISO Downloader",
[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,41 +55,79 @@ 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.
# Note that because we don't want to have to support this script on anything
# other than Windows, this call returns 0.0 for PowerShell running on Linux/Mac.
function Get-Platform-Version()
{
$version = 0.0
$platform = [string][System.Environment]::OSVersion.Platform
# This will filter out non Windows platforms
if ($platform.StartsWith("Win")) {
# Craft a decimal numeric version of Windows
$version = [System.Environment]::OSVersion.Version.Major * 1.0 + [System.Environment]::OSVersion.Version.Minor * 0.1
}
return $version
}
$winver = Get-Platform-Version
# The default TLS for Windows 8.x doesn't work with Microsoft's servers so we must force it
if ($winver -lt 10.0) {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
}
#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...
if ($host.version -ge "7.0") {
Add-Type -WarningAction Ignore -IgnoreWarnings -MemberDefinition $code -Namespace Gui -UsingNamespace System.Runtime, System.IO, System.Text, System.Drawing, System.Globalization -ReferencedAssemblies System.Drawing.Common -Name Utils -ErrorAction Stop
} else {
Add-Type -MemberDefinition $code -Namespace Gui -UsingNamespace System.IO, System.Text, System.Drawing, System.Globalization -ReferencedAssemblies System.Drawing -Name Utils -ErrorAction Stop
if (!("WinAPI.Utils" -as [type]))
{
Add-Type @Signature
}
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
@@ -98,186 +138,41 @@ $WindowsVersions = @(
@(
@("Windows 11", "windows11"),
@(
"22H2 (Build 22621.382 - 2022.09)",
@("Windows 11 Home/Pro/Edu", 2360),
@("Windows 11 Home China ", ($zh + 2361))
),
@(
"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"),
@(
"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))
"22H2 v1 (Build 19045.2965 - 2023.05)",
@("Windows 10 Home/Pro/Edu", 2618),
@("Windows 10 Home China ", ($zh + 2378))
)
),
@(
@("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),
@("Debug", 1)
),
@(
"22H1 (edk2-stable202205)",
@("Release", 0),
@@ -300,49 +195,13 @@ $WindowsVersions = @(
)
),
@(
@("UEFI Shell 2.0", "UEFI_SHELL 2.0"),
@("UEFI Shell 2.0", "UEFI_SHELL 2.0"),
@(
"4.632 [20100426]",
@("Release", 0)
)
)
)
$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
@@ -392,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)
@@ -486,8 +345,8 @@ function ConvertTo-ImageSource
function Throw-Error([object]$Req, [string]$Alt)
{
$Err = $(GetElementById -Request $r -Id "errorModalMessage").innerText
if (-not $Err) {
$Err = $(GetElementById -Request $Req -Id "errorModalMessage").innerText -replace "<[^>]+>" -replace "\s+", " "
if (!$Err) {
$Err = $Alt
} else {
$Err = [System.Text.Encoding]::UTF8.GetString([byte[]][char[]]$Err)
@@ -498,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)"
}
@@ -536,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 {
@@ -572,6 +431,7 @@ function Get-RandomDate()
#region Globals
$ErrorActionPreference = "Stop"
$DefaultTimeout = 30
$dh = 58
$Stage = 0
$SelectedIndex = 0
@@ -582,14 +442,14 @@ 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" )
# This GUID applies to visitors of the en-US download page. Other locales may get a different GUID.
$RequestData["GetLinks"] = @("6e2a1789-ef16-4f27-a296-74ef7ef5d96b", "GetProductDownloadLinksBySku" )
# Create a semi-random Linux User-Agent string
$FirefoxVersion = Get-Random -Minimum 50 -Maximum 90
$FirefoxVersion = Get-Random -Minimum 90 -Maximum 110
$FirefoxDate = Get-RandomDate
$UserAgent = "Mozilla/5.0 (X11; Linux i586; rv:$FirefoxVersion.0) Gecko/$FirefoxDate Firefox/$FirefoxVersion.0"
$Verbosity = 2
@@ -604,30 +464,25 @@ if ($Cmd) {
# Localization
$EnglishMessages = "en-US|Version|Release|Edition|Language|Architecture|Download|Continue|Back|Close|Cancel|Error|Please wait...|" +
"Download using a browser|Temporarily banned by Microsoft for requesting too many downloads - Please try again later...|" +
"PowerShell 3.0 or later is required to run this script.|Do you want to go online and download it?"
"Download using a browser|Download of Windows ISOs is unavailable due to Microsoft having altered their website to prevent it.|" +
"PowerShell 3.0 or later is required to run this script.|Do you want to go online and download it?|" +
"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('|')
if ($Localized.Length -ne $English.Length) {
Write-Host "Error: Missing or extra translated messages provided ($($Localized.Length)/$($English.Length))"
exit 101
# Adjust the $Localized array if we have more or fewer strings than in $EnglishMessages
if ($Localized.Length -lt $English.Length) {
while ($Localized.Length -ne $English.Length) {
$Localized += $English[$Localized.Length]
}
} elseif ($Localized.Length -gt $English.Length) {
$Localized = $LocData.Split('|')[0..($English.Length - 1)]
}
$Locale = $Localized[0]
}
$QueryLocale = $Locale
# Make sure PowerShell 3.0 or later is used (for Invoke-WebRequest)
if ($PSVersionTable.PSVersion.Major -lt 3) {
Write-Host Error: PowerShell 3.0 or later is required to run this script.
$Msg = "$(Get-Translation($English[15]))`n$(Get-Translation($English[16]))"
if ([System.Windows.MessageBox]::Show($Msg, $(Get-Translation("Error")), "YesNo", "Error") -eq "Yes") {
Start-Process -FilePath https://www.microsoft.com/download/details.aspx?id=34595
}
exit 102
}
# Convert a size in bytes to a human readable string
function Size-To-Human-Readable([uint64]$size)
{
@@ -641,14 +496,25 @@ function Size-To-Human-Readable([uint64]$size)
}
# Check if the locale we want is available - Fall back to en-US otherwise
function Check-Locale {
function Check-Locale
{
try {
$url = "https://www.microsoft.com/" + $QueryLocale + "/software-download/"
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"
}
}
@@ -697,6 +563,17 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
} elseif ($WindowsVersions[$SelectedVersion][0][1].StartsWith("UEFI_SHELL")) {
$languages += @(New-Object PsObject -Property @{ DisplayLanguage = "English (US)"; Language = "en-us"; Id = 0 })
} else {
# Microsoft download protection now requires the sessionId to be whitelisted through vlscppe.microsoft.com/tags
$url = "https://vlscppe.microsoft.com/tags?org_id=y6jn8c31&session_id=" + $SessionId
if ($Verbosity -ge 2) {
Write-Host Querying $url
}
try {
Invoke-WebRequest -UseBasicParsing -TimeoutSec $DefaultTimeout -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
} catch {
Error($_.Exception.Message)
return @()
}
$url = "https://www.microsoft.com/" + $QueryLocale + "/api/controls/contentinclude/html"
$url += "?pageId=" + $RequestData["GetLangs"][0]
$url += "&host=www.microsoft.com"
@@ -711,11 +588,12 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
$script:SelectedIndex = 0
try {
$r = Invoke-WebRequest -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"
}
$pattern = '(?s)<select id="product-languages">(.*)?</select>'
$r = $r -replace "`n" -replace "`r"
$pattern = '.*<select id="product-languages"[^>]*>(.*)</select>.*'
$html = [regex]::Match($r, $pattern).Groups[1].Value
# Go through an XML conversion to keep all PowerShells happy...
$html = $html.Replace("selected value", "value")
@@ -766,7 +644,7 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
$xml = New-Object System.Xml.XmlDocument
if ($Verbosity -ge 2) {
Write-Host Querying $url
}
}
$xml.Load($url)
$sep = ""
$archs = ""
@@ -798,20 +676,18 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
try {
$Is64 = [Environment]::Is64BitOperatingSystem
# Must add a referer for POST requests, else Microsoft's servers will deny them
# Must add a referer for this request, else Microsoft's servers will deny it
$ref = "https://www.microsoft.com/software-download/windows11"
$wr = [System.Net.WebRequest]::Create($url)
# Windows 7 PowerShell doesn't support 'Invoke-WebRequest -Headers @{"Referer" = $ref}'
# (produces "The 'Referer' header must be modified using the appropriate property or method")
# so we use StreamReader() with GetResponseStream() and do this whole gymkhana instead...
$wr.Method = "POST"
$wr.Referer = $ref
$wr.UserAgent = $UserAgent
$wr.ContentLength = 0
$sr = New-Object System.IO.StreamReader($wr.GetResponse().GetResponseStream())
$r = $sr.ReadToEnd()
$r = Invoke-WebRequest -Method Post -Headers @{ "Referer" = $ref } -UseBasicParsing -TimeoutSec $DefaultTimeout -UserAgent $UserAgent -WebSession $Session $url
if ($r -match "errorModalMessage") {
Throw-Error -Req $r -Alt "Could not retrieve architectures from server"
$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"
} elseif ($Alt -match "715-123130") {
$Alt += " " + $SessionId + "."
}
Throw-Error -Req $r -Alt $Alt
}
$pattern = '(?s)(<input.*?></input>)'
ForEach-Object { [regex]::Matches($r, $pattern) } | ForEach-Object { $html += $_.Groups[1].value }
@@ -826,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 })
@@ -848,18 +724,18 @@ 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)..."
Invoke-WebRequest -UseBasicParsing -Uri $Url -OutFile $File
Start-BitsTransfer -Source $Url -Destination $File
} else {
Write-Host Download Link: $Url
Start-Process -FilePath $Url
@@ -880,6 +756,12 @@ if ($Cmd) {
$winLanguageName = $null
$winLink = $null
# Windows 7 and non Windows platforms are too much of a liability
if ($winver -le 6.1) {
Error(Get-Translation("This feature is not available on this platform."))
exit 403
}
$i = 0
$Selected = ""
if ($Win -eq "List") {
@@ -940,7 +822,7 @@ if ($Cmd) {
if (!$Ed -and $Verbosity -ge 1) {
Write-Host "No edition specified (-Ed). Defaulting to '$($edition.Edition)'."
}
$Selected += "," + $edition.Edition -replace "Windows [0-9\.]*", ""
$Selected += "," + $edition.Edition -replace "Windows [0-9\.]*"
$winEditionId = $edition.Id
break;
}
@@ -960,6 +842,10 @@ if ($Cmd) {
}
if ($Lang -eq "List") {
Write-Host "Please select a Language (-Lang) for ${Selected}:"
} elseif ($Lang) {
# Escape parentheses so that they aren't interpreted as regex
$Lang = $Lang.replace('(', '\(')
$Lang = $Lang.replace(')', '\)')
}
$i = 0
foreach ($language in $languages) {
@@ -976,7 +862,7 @@ if ($Cmd) {
}
$i++
}
if ($winLanguageId -eq $null -or $winLanguageName -eq $null) {
if (!$winLanguageId -or !$winLanguageName) {
if ($Lang -ne "List") {
Write-Host "Invalid Windows language provided."
Write-Host "Use '-Lang List' for a list of available languages or remove the option to use system default."
@@ -1034,7 +920,7 @@ $XMLForm.Title = $AppTitle
if ($Icon) {
$XMLForm.Icon = $Icon
} else {
$XMLForm.Icon = [Gui.Utils]::ExtractIcon("shell32.dll", -41, $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"
@@ -1043,6 +929,12 @@ $WindowsVersionTitle.Text = Get-Translation("Version")
$Continue.Content = Get-Translation("Continue")
$Back.Content = Get-Translation("Close")
# Windows 7 and non Windows platforms are too much of a liability
if ($winver -le 6.1) {
Error(Get-Translation("This feature is not available on this platform."))
exit 403
}
# Populate the Windows versions
$i = 0
$versions = @()
@@ -1056,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)
@@ -1067,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
@@ -1126,9 +1018,9 @@ $Continue.add_click({
$XMLForm.Close()
}
}
$Continue.IsEnabled = $True
$Continue.IsEnabled = $true
if ($Stage -ge 0) {
$Back.IsEnabled = $True
$Back.IsEnabled = $true
}
})
@@ -1138,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"
@@ -1163,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
@@ -1172,8 +1064,8 @@ exit $ExitCode
# SIG # Begin signature block
# MIIkWQYJKoZIhvcNAQcCoIIkSjCCJEYCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDUeFzYLyGc6jXF
# dBz+FBcylnkilIubS5cDHWoqJHxaM6CCElkwggVvMIIEV6ADAgECAhBI/JO0YFWU
# KX7zUQIBAAIBAAIBAAIBA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jde+vv8Z
# WiczMDcGCyqGSIb3DQEJEAIvMSgwJjAkMCIEIMR0znYAfQI5Tg2l5N58FMaA+eKC
# ATz+9lPvXbcf32H4MAsGCSqGSIb3DQEBAQSCAQCmIEtfCe7GnEezhZmxNvjQG68a
# z9Ve9nQbbwqf+q4nHnkBo2GC0Yy/DxnX4guloxGcw/9DVwxzzC7ItJEG0qmAY0Pl
# bdDVLyldAwZYcY43LriCS80x5xLZQjkpPSQurs3uTcGbwkqno20XZdRMSvUYdI0K
# how//ZKXn9XcQGcvaCIGCzttS433m3khkILUiVvZNOqGERX6BqNjX5OX4QscK1uR
# kRKEPdL9WMIv3MX902bnnC8OqeuHcKcjdIuokzGfDYoGJe8aGOWTsScivdft+5Go
# C1W4KLv7+jEF0n05S0Sd/ebBFYM4Zq2EQVpj1KeLyrPHonZYwZGzbXpwRC3W
# 9w0BCQMxDQYLKoZIhvcNAQkQAQQwHAYJKoZIhvcNAQkFMQ8XDTI0MDcwODExMzI1
# NFowLwYJKoZIhvcNAQkEMSIEIG/gQQhpzPfxlpm/2tdmW6X9awf2Czk8/cxR7UCg
# 43d7MDcGCyqGSIb3DQEJEAIvMSgwJjAkMCIEIMR0znYAfQI5Tg2l5N58FMaA+eKC
# ATz+9lPvXbcf32H4MAsGCSqGSIb3DQEBAQSCAQCCag3lcuzdiyncWrIwSqi4eLMA
# lg4Yqhxm2ws63eTEN9jYdQlOqgLE2fVhykqKwfUqm29RSPsK0twBhVxUSl+779Fd
# r2M1C4t5z6SDKrpJQSb0dKvRG6VD5FFwU43XITJFtKXsu9EcM9SizV1fk6/DUUEw
# 1uFPptTjB6god6UJb18em84DS11lFVfc1R5nTqmNdJ4PQLM3U0wqjR4vfQkCW+0u
# diqsdHIkLXzvzK8uPU4IgfN14O20gxwB7L1n8roe/ibil8elFUwHICC44ddHGYsd
# SN66NREeU82z+4vis38lWzIajhuGNaXa/kSDB31yL431CgPtW+RxMj4D/DvM
# SIG # End signature block

View File

@@ -1,35 +0,0 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>6CAFC0C6-A428-4d30-A9F9-700E829FEA51</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Fido</RootNamespace>
<AssemblyName>Fido</AssemblyName>
<Name>Frida</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup />
<ItemGroup>
<Compile Include="Fido.ps1" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="Build" />
<Import Project="$(MSBuildExtensionsPath)\PowerShell Tools for Visual Studio\PowerShellTools.targets" Condition="Exists('$(MSBuildExtensionsPath)\PowerShell Tools for Visual Studio\PowerShellTools.targets')" />
</Project>

View File

@@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.271
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F5034706-568F-408A-B7B3-4D38C6DB8A32}") = "Fido", "Fido.pssproj", "{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CAFC0C6-A428-4D30-A9F9-700E829FEA51}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AD54CEAE-0992-4213-BEDB-8F1CF98A9F22}
EndGlobalSection
EndGlobal

View File

@@ -1,5 +1,5 @@
Fido: A PowerShell download script for Windows ISOs and UEFI Shell
==================================================================
Fido: A PowerShell download script for Microsoft Windows and UEFI Shell ISOs
============================================================================
[![Licence](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0.en.html)
[![Github stats](https://img.shields.io/github/downloads/pbatard/Fido/total.svg?style=flat-square)](https://github.com/pbatard/Fido/releases)
@@ -9,12 +9,12 @@ Description
Fido is a PowerShell script that is primarily designed to be used in [Rufus](https://github.com/pbatard/rufus), but that
can also be used in standalone fashion, and whose purpose is to automate access to the official Microsoft Windows retail
ISO download links as well as provide convenient access to bootable UEFI Shell images.
ISO download links as well as provide convenient access to [bootable UEFI Shell images](https://github.com/pbatard/UEFI-Shell).
This script exists because, while Microsoft does make retail ISO download links freely and publicly available (at least
for Windows 8 and Windows 10), it only does so after actively forcing users to jump through a lot of unwarranted hoops,
that create an exceedingly counterproductive, if not downright unfriendly, consumer experience and that greatly detract
from what people really want (direct access to ISO downloads).
for Windows 8 through Windows 11), up until recent releases, most of these links were only available after forcing users
to jump through a lot of unwarranted hoops that created an exceedingly counterproductive, if not downright unfriendly,
consumer experience, that greatly detracted from what people really want (direct access to ISO downloads).
As to the reason one might want to download Windows __retail__ ISOs, as opposed to the ISOs that are generated by
Microsoft's own Media Creation Tool (MCT), this is because using official retail ISOs is currently the only way to
@@ -42,26 +42,21 @@ License
How it works
------------
The script basically performs the same operation as one might perform when visiting either of the following URLs (that
is, provided that you have also changed your `User-Agent` browser string, since, when they detect that you are using a
version of Windows that is the same as the one you are trying to download, the Microsoft web servers at these addresses
redirect you __away__ from the pages that allow you to download retail ISOs):
The script basically performs the same operation as one might perform when visiting the following URL (that is, in the
case of Windows 10, provided that you have also changed your `User-Agent` browser string, since, the Microsoft web
servers detect that you are using a version of Windows that is the same as the one you are trying to download, they
may redirect you __away__ from the page that allows you to obtain a direct ISO download link):
https://www.microsoft.com/en-us/software-download
After checking access to these URLs, to confirm that they are accessible, the script first queries the web API from the
After checking basic access to the Microsoft software downloads website the script first queries the web API from the
Microsoft servers, to request the language selection available for the version of Windows selected, and then requests
the actual download links for all the architectures available for that language + version.
the actual download links, for all the architectures available for that language + version.
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.

View File

@@ -21,7 +21,7 @@ sign_file() {
}
# Update the Authenticode signature
cmd.exe /c '"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\signtool" sign /v /sha1 3dbc3a2a0e9ce8803b422cfdbc60acd33164965d /fd SHA256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 Fido.ps1'
MSYS2_ARG_CONV_EXCL='*' "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\signtool" sign /v /sha1 3dbc3a2a0e9ce8803b422cfdbc60acd33164965d /fd SHA256 /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 Fido.ps1
read -s -p "Enter pass phrase for `realpath $PRIVATE_KEY`: " PASSWORD
echo
# Confirm that the pass phrase is valid by trying to sign a dummy file