mirror of
https://github.com/pbatard/Fido.git
synced 2025-09-16 14:18:02 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
84f833b067 | ||
![]() |
c34a41fe3f | ||
![]() |
6593585ff3 | ||
![]() |
fac4c49262 | ||
![]() |
f8aacf0703 | ||
![]() |
24a7a04d78 | ||
![]() |
eefc2453c4 | ||
![]() |
ed1a6b31a6 | ||
![]() |
9beb231b78 | ||
![]() |
ce7cb583e5 |
111
Fido.ps1
111
Fido.ps1
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Fido v1.31 - Feature ISO Downloader, for retail Windows images and UEFI Shell
|
||||
# Copyright © 2019-2022 Pete Batard <pete@akeo.ie>
|
||||
# Fido v1.38 - Feature ISO Downloader, for retail Windows images and UEFI Shell
|
||||
# Copyright © 2019-2023 Pete Batard <pete@akeo.ie>
|
||||
# Command line support: Copyright © 2021 flx5
|
||||
# ConvertTo-ImageSource: Copyright © 2016 Chris Carter
|
||||
#
|
||||
@@ -45,7 +45,9 @@ param(
|
||||
# (Optional) Only display the download URL [Toggles commandline mode]
|
||||
[switch]$GetUrl = $False,
|
||||
# (Optional) Increase verbosity
|
||||
[switch]$Verbose = $False
|
||||
[switch]$Verbose = $False,
|
||||
# (Optional) Disable the progress bar
|
||||
[switch]$DisableProgress = $False
|
||||
)
|
||||
#endregion
|
||||
|
||||
@@ -80,11 +82,12 @@ $code = @"
|
||||
|
||||
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") {
|
||||
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
|
||||
$Drawing_Assembly += ".Common"
|
||||
}
|
||||
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
|
||||
@@ -97,6 +100,11 @@ $ko = 0x20000
|
||||
$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),
|
||||
@@ -110,6 +118,11 @@ $WindowsVersions = @(
|
||||
),
|
||||
@(
|
||||
@("Windows 10", "Windows10ISO"),
|
||||
@(
|
||||
"22H2 (Build 19045.2006 - 2022.10)",
|
||||
@("Windows 10 Home/Pro/Edu", 2377),
|
||||
@("Windows 10 Home China ", ($zh + 2378))
|
||||
),
|
||||
@(
|
||||
"21H2 (Build 19044.1288 - 2021.11)",
|
||||
@("Windows 10 Home/Pro/Edu", 2084),
|
||||
@@ -273,6 +286,11 @@ $WindowsVersions = @(
|
||||
),
|
||||
@(
|
||||
@("UEFI Shell 2.2", "UEFI_SHELL 2.2"),
|
||||
@(
|
||||
"22H2 (edk2-stable202211)",
|
||||
@("Release", 0),
|
||||
@("Debug", 1)
|
||||
),
|
||||
@(
|
||||
"22H1 (edk2-stable202205)",
|
||||
@("Release", 0),
|
||||
@@ -481,7 +499,7 @@ function ConvertTo-ImageSource
|
||||
|
||||
function Throw-Error([object]$Req, [string]$Alt)
|
||||
{
|
||||
$Err = $(GetElementById -Request $r -Id "errorModalMessage").innerText
|
||||
$Err = $(GetElementById -Request $Req -Id "errorModalMessage").innerText -replace '<[^>]+>',''
|
||||
if (-not $Err) {
|
||||
$Err = $Alt
|
||||
} else {
|
||||
@@ -795,9 +813,25 @@ function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease
|
||||
$Is64 = [Environment]::Is64BitOperatingSystem
|
||||
# Must add a referer for POST requests, else Microsoft's servers will deny them
|
||||
$ref = "https://www.microsoft.com/software-download/windows11"
|
||||
$r = Invoke-WebRequest -Method Post -Headers @{"Referer" = $ref} -UseBasicParsing -UserAgent $UserAgent -WebSession $Session $url
|
||||
$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()
|
||||
if ($r -match "errorModalMessage") {
|
||||
Throw-Error -Req $r -Alt "Could not retrieve architectures from server"
|
||||
$regex = New-Object Text.RegularExpressions.Regex '<p id="errorModalMessage">(.+?)<\/p>'
|
||||
$m = $regex.Match($r)
|
||||
# Make the typical error message returned by Microsoft's servers more presentable
|
||||
$Alt = $m.Groups[1] -replace '<[^>]+>' -replace ' Microsoft Support – Contact Us ',' "Microsoft Support – Contact Us" ' -replace ' and$','.'
|
||||
if (-not $Alt) {
|
||||
$Alt = "Could not retrieve architectures from server"
|
||||
}
|
||||
Throw-Error -Req $r -Alt $Alt
|
||||
}
|
||||
$pattern = '(?s)(<input.*?></input>)'
|
||||
ForEach-Object { [regex]::Matches($r, $pattern) } | ForEach-Object { $html += $_.Groups[1].value }
|
||||
@@ -845,6 +879,9 @@ function Process-Download-Link([string]$Url)
|
||||
$tmp_size = [uint64]::Parse($str_size)
|
||||
$Size = Size-To-Human-Readable $tmp_size
|
||||
Write-Host "Downloading '$File' ($Size)..."
|
||||
if ($DisableProgress) {
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
}
|
||||
Invoke-WebRequest -UseBasicParsing -Uri $Url -OutFile $File
|
||||
} else {
|
||||
Write-Host Download Link: $Url
|
||||
@@ -946,6 +983,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) {
|
||||
@@ -962,7 +1003,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."
|
||||
@@ -1158,8 +1199,8 @@ exit $ExitCode
|
||||
# SIG # Begin signature block
|
||||
# MIIkWAYJKoZIhvcNAQcCoIIkSTCCJEUCAQExDzANBglghkgBZQMEAgEFADB5Bgor
|
||||
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
|
||||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAiZT+pEprxewVE
|
||||
# +Vpi/MqR7ClFwopa4p2nE7rw5/vvS6CCElkwggVvMIIEV6AD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YPLl3JIpm4NAk379R3xzpFe02aZKwULDhPukw
|
||||
# N0DNqmNUJj7YRxq56BbDN0Vw9HAAOWq02PXffqhUwS9vBUMBZDQjIxiBRdJdBGqn
|
||||
# 1oaS25drZ1c+MmJL+Q3lpBYxKWzKs6DYX1M+p2bpxB9QU+x8FjHoFB0ogwwDKLGa
|
||||
# z6G4Vq2oTrTkvc6qYYukUiOoxZX79IlkzrYtAkjLQY7nIZsF/oiP4rnAuew=
|
||||
# SIG # End signature block
|
||||
|
25
README.md
25
README.md
@@ -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
|
||||
============================================================================
|
||||
|
||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
[](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,16 +42,16 @@ 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
|
||||
------------
|
||||
@@ -87,6 +87,7 @@ The options are:
|
||||
architecture as the one from the current system.
|
||||
- `GetUrl`: By default, the script attempts to automatically launch the download. But when using the `-GetUrl` switch,
|
||||
the script only displays the download URL, which can then be piped into another command or into a file.
|
||||
- `DisableProgress`: Disable progress report. This may speed up downloads when using the command line.
|
||||
|
||||
Examples of a commandline download:
|
||||
|
||||
|
Reference in New Issue
Block a user