mirror of
https://github.com/pbatard/Fido.git
synced 2025-09-16 22:28:02 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e293e97bac | ||
![]() |
b1eebac8dc | ||
![]() |
8508ac6164 | ||
![]() |
eac06c958f | ||
![]() |
2ee5f896d3 | ||
![]() |
28725b287c | ||
![]() |
b7331f7873 |
139
Fido.ps1
139
Fido.ps1
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Fido v1.21 - Retail Windows ISO Downloader
|
||||
# Fido v1.26 - Feature ISO Downloader, for retail Windows images and UEFI Shell
|
||||
# Copyright © 2019-2021 Pete Batard <pete@akeo.ie>
|
||||
# Command line support: Copyright © 2021 flx5
|
||||
# ConvertTo-ImageSource: Copyright © 2016 Chris Carter
|
||||
@@ -95,6 +95,14 @@ if (!$Cmd) {
|
||||
$zh = 0x10000
|
||||
$ko = 0x20000
|
||||
$WindowsVersions = @(
|
||||
@(
|
||||
@("Windows 11", "windows11"),
|
||||
@(
|
||||
"21H2 (Build 22000.194 - 2021.10)",
|
||||
@("Windows 11 Home/Pro", 2069),
|
||||
@("Windows 11 Home China ", ($zh + 2070))
|
||||
)
|
||||
),
|
||||
@(
|
||||
@("Windows 10", "Windows10ISO"),
|
||||
@(
|
||||
@@ -139,6 +147,12 @@ $WindowsVersions = @(
|
||||
@("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),
|
||||
@@ -246,6 +260,31 @@ $WindowsVersions = @(
|
||||
@("Windows 7 Professional", 1),
|
||||
@("Windows 7 Home Premium", 2)
|
||||
)
|
||||
),
|
||||
@(
|
||||
@("UEFI Shell 2.2", "UEFI_SHELL 2.2"),
|
||||
@(
|
||||
"21H2 (edk2-stable202108)",
|
||||
@("Release", 0),
|
||||
@("Debug", 1)
|
||||
),
|
||||
@(
|
||||
"21H1 (edk2-stable202105)",
|
||||
@("Release", 0),
|
||||
@("Debug", 1)
|
||||
),
|
||||
@(
|
||||
"20H2 (edk2-stable202011)",
|
||||
@("Release", 0),
|
||||
@("Debug", 1)
|
||||
)
|
||||
),
|
||||
@(
|
||||
@("UEFI Shell 2.0", "UEFI_SHELL 2.0"),
|
||||
@(
|
||||
"4.632 [20100426]",
|
||||
@("Release", 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -570,7 +609,7 @@ if ($PSVersionTable.PSVersion.Major -lt 3) {
|
||||
}
|
||||
|
||||
# Convert a size in bytes to a human readable string
|
||||
function Size-To-Human-Readable([uint64]$size)
|
||||
function Size-To-Human-Readable([uint64]$size)
|
||||
{
|
||||
$suffix = "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"
|
||||
$i = 0
|
||||
@@ -635,11 +674,13 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
|
||||
}
|
||||
$i++
|
||||
}
|
||||
} elseif ($WindowsVersions[$SelectedVersion][0][1].StartsWith("UEFI_SHELL")) {
|
||||
$languages += @(New-Object PsObject -Property @{ DisplayLanguage = "English (US)"; Language = "en-us"; Id = 0 })
|
||||
} else {
|
||||
$url = "https://www.microsoft.com/" + $QueryLocale + "/api/controls/contentinclude/html"
|
||||
$url += "?pageId=" + $RequestData["GetLangs"][0]
|
||||
$url += "&host=www.microsoft.com"
|
||||
$url += "&segments=software-download," + $WindowsVersions[$SelectedVersion][0][1]
|
||||
$url += "&segments=software-download," + $WindowsVersions[$SelectedVersion][0][1]
|
||||
$url += "&query=&action=" + $RequestData["GetLangs"][1]
|
||||
$url += "&sessionId=" + $SessionId
|
||||
$url += "&productEditionId=" + [Math]::Abs($SelectedEdition)
|
||||
@@ -682,18 +723,47 @@ function Get-Windows-Languages([int]$SelectedVersion, [int]$SelectedEdition)
|
||||
}
|
||||
|
||||
# Return an array of download links for each supported arch
|
||||
function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedEdition, [int]$SkuId, [string]$LanguageName)
|
||||
function Get-Windows-Download-Links([int]$SelectedVersion, [int]$SelectedRelease, [int]$SelectedEdition, [string]$SkuId, [string]$LanguageName)
|
||||
{
|
||||
$links = @()
|
||||
if ($WindowsVersions[$SelectedVersion][0][1] -eq "WIN7") {
|
||||
foreach ($Version in $Windows7Versions[$SelectedEdition][$SkuId][2]) {
|
||||
$links += @(New-Object PsObject -Property @{ Type = $Version[0]; Link = $Version[1] })
|
||||
}
|
||||
} elseif ($WindowsVersions[$SelectedVersion][0][1].StartsWith("UEFI_SHELL")) {
|
||||
$tag = $WindowsVersions[$SelectedVersion][$SelectedRelease][0].Split(' ')[0]
|
||||
$shell_version = $WindowsVersions[$SelectedVersion][0][1].Split(' ')[1]
|
||||
$url = "https://github.com/pbatard/UEFI-Shell/releases/download/" + $tag
|
||||
$link = $url + "/UEFI-Shell-" + $shell_version + "-" + $tag
|
||||
if ($SelectedEdition -eq 0) {
|
||||
$link += "-RELEASE.iso"
|
||||
} else {
|
||||
$link += "-DEBUG.iso"
|
||||
}
|
||||
try {
|
||||
# Read the supported archs from the release URL
|
||||
$url += "/Version.xml"
|
||||
$xml = New-Object System.Xml.XmlDocument
|
||||
if ($Verbosity -ge 2) {
|
||||
Write-Host Querying $url
|
||||
}
|
||||
$xml.Load($url)
|
||||
$sep = ""
|
||||
$archs = ""
|
||||
foreach($arch in $xml.release.supported_archs.arch) {
|
||||
$archs += $sep + $arch
|
||||
$sep = ", "
|
||||
}
|
||||
$links += @(New-Object PsObject -Property @{ Type = $archs; Link = $link })
|
||||
} catch {
|
||||
Error($_.Exception.Message)
|
||||
return @()
|
||||
}
|
||||
} else {
|
||||
$url = "https://www.microsoft.com/" + $QueryLocale + "/api/controls/contentinclude/html"
|
||||
$url += "?pageId=" + $RequestData["GetLinks"][0]
|
||||
$url += "&host=www.microsoft.com"
|
||||
$url += "&segments=software-download," + $WindowsVersions[$SelectedVersion][0][1]
|
||||
$url += "&segments=software-download," + $WindowsVersions[$SelectedVersion][0][1]
|
||||
$url += "&query=&action=" + $RequestData["GetLinks"][1]
|
||||
$url += "&sessionId=" + $SessionId
|
||||
$url += "&skuId=" + $SkuId
|
||||
@@ -752,8 +822,11 @@ function Process-Download-Link([string]$Url)
|
||||
} else {
|
||||
if ($Cmd) {
|
||||
$pattern = '.*\/(.*\.iso).*'
|
||||
$File = [regex]::Match($Url, $pattern).Groups[1].Value
|
||||
$Size = Size-To-Human-Readable (Invoke-WebRequest -UseBasicParsing -Uri $Url -Method Head).Headers.'Content-Length'
|
||||
$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'
|
||||
$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
|
||||
} else {
|
||||
@@ -881,7 +954,7 @@ if ($Cmd) {
|
||||
}
|
||||
|
||||
# Language selection => Request and populate Arch download links
|
||||
$links = Get-Windows-Download-Links $winVersionId $winEditionId $winLanguageId $winLanguageName
|
||||
$links = Get-Windows-Download-Links $winVersionId $winReleaseId $winEditionId $winLanguageId $winLanguageName
|
||||
if (!$links) {
|
||||
exit 3
|
||||
}
|
||||
@@ -896,7 +969,7 @@ if ($Cmd) {
|
||||
if (!$Arch -and $Verbosity -ge 1) {
|
||||
Write-Host "No architecture specified (-Arch). Defaulting to '$($link.Type)'."
|
||||
}
|
||||
$Selected += ", " + $link.Type
|
||||
$Selected += ", [" + $link.Type + "]"
|
||||
$winLink = $link
|
||||
break;
|
||||
}
|
||||
@@ -912,7 +985,7 @@ if ($Cmd) {
|
||||
|
||||
# Arch selection => Return selected download link
|
||||
if ($GetUrl) {
|
||||
Write-Host $winLink.Link
|
||||
Return $winLink.Link
|
||||
$ExitCode = 0
|
||||
} else {
|
||||
Write-Host "Selected: $Selected"
|
||||
@@ -963,7 +1036,9 @@ $Continue.add_click({
|
||||
1 { # Windows Version selection
|
||||
$XMLForm.Title = Get-Translation($English[12])
|
||||
Refresh-Control($XMLForm)
|
||||
Check-Locale
|
||||
if ($WindowsVersion.SelectedValue.Version.StartsWith("Windows") -and $WindowsVersion.SelectedValue.Version -ne "Windows 7") {
|
||||
Check-Locale
|
||||
}
|
||||
$releases = Get-Windows-Releases $WindowsVersion.SelectedValue.Index
|
||||
$script:WindowsRelease = Add-Entry $Stage "Release" $releases
|
||||
$Back.Content = Get-Translation($English[8])
|
||||
@@ -990,7 +1065,7 @@ $Continue.add_click({
|
||||
4 { # Language selection => Request and populate Arch download links
|
||||
$XMLForm.Title = Get-Translation($English[12])
|
||||
Refresh-Control($XMLForm)
|
||||
$links = Get-Windows-Download-Links $WindowsVersion.SelectedValue.Index $ProductEdition.SelectedValue.Id $Language.SelectedValue.Id $Language.SelectedValue.Language
|
||||
$links = Get-Windows-Download-Links $WindowsVersion.SelectedValue.Index $WindowsRelease.SelectedValue.Index $ProductEdition.SelectedValue.Id $Language.SelectedValue.Id $Language.SelectedValue.Language
|
||||
if ($links.Length -eq 0) {
|
||||
break
|
||||
}
|
||||
@@ -1066,8 +1141,8 @@ exit $ExitCode
|
||||
# SIG # Begin signature block
|
||||
# MIIcQgYJKoZIhvcNAQcCoIIcMzCCHC8CAQExDzANBglghkgBZQMEAgEFADB5Bgor
|
||||
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
|
||||
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCC8WEqsYMEmJywK
|
||||
# KfrYLzANdf83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||
# gvnBiX1f9CnmFhcM6RVnhAnUkpRmd+sgXMF15vM3sql+R99ou5C+Jfmh9YVWHZk+
|
||||
# CvOABIeNLf4Ny58etDYlfBilaDluDgatl801zLaRq9kxTwAYlMEqlJ5NfdUdXLWZ
|
||||
# dDik6XJiPLZFvdOPkwwbqX49JVJqqaRZSV0bx70X1y5MBExoBAg=
|
||||
# tx/fYfgwCwYJKoZIhvcNAQEBBIIBAG4XNFoioU2nWY0eeLO56kWzL6zFTqjYS3fL
|
||||
# pAjv0sNj7RP0YAUkNC/IK3BQfa/n/pVcrsUTPg0ZECPJJD6ChZfUhrU6YG9o0QGs
|
||||
# s7DtvXMykusVV1I+H6pTfKBjuVMhIkzswEyD+PP+FxbKkJZRX0HDv39ltevRs+yk
|
||||
# ZU9uP5tGCOwrd1JqPYBKnBCjIZb08W7tHdZbYDL+ve2k9qBLmGMIcuJ/9AXzQHJS
|
||||
# 0YJV24161ZpddNUoLevgvRTdU1nR8DMsZ0RwPZXA9q8Z4jEQbQW0OYwfEr53tTRw
|
||||
# z+o4T45hAta+SbpHg4dThdS6wv6gF849BseXSUx8nggduBE+EAc=
|
||||
# SIG # End signature block
|
||||
|
13
README.md
13
README.md
@@ -1,5 +1,5 @@
|
||||
Fido: Full ISO Download Script (for Windows retail ISOs)
|
||||
========================================================
|
||||
Fido: A PowerShell download script for Windows ISOs and UEFI Shell
|
||||
==================================================================
|
||||
|
||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||
[](https://github.com/pbatard/Fido/releases)
|
||||
@@ -9,7 +9,7 @@ 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.
|
||||
ISO download links as well as provide convenient access to bootable UEFI Shell images.
|
||||
|
||||
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,
|
||||
@@ -50,10 +50,9 @@ redirect you __away__ from the pages that allow you to download retail ISOs):
|
||||
* https://www.microsoft.com/software-download/Windows8ISO
|
||||
* https://www.microsoft.com/software-download/Windows10ISO
|
||||
|
||||
After visiting those with a full browser (Internet Explorer, running through the `Invoke-WebRequest` PowerShell Cmdlet),
|
||||
to confirm that they are accessible, the script then queries the web API from the Microsoft servers to first request the
|
||||
language selection available for the version of Windows selected by the user, and then request the actual download links
|
||||
for all the architectures available for that specific combination of version + language.
|
||||
After checking access to these URLs, to confirm that they are accessible, 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.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
Reference in New Issue
Block a user